Git merge to all branches

戏子无情 提交于 2020-01-06 04:01:06

问题


I have branches

v1.0
v1.1
v1.2
v1.3
v1.4 [master]

now i checkout the v1.0 and add some directory with files (db tables, stored procedures, etc)

how to merge the newly added directory with files in all branches so my head branch will be updated with that directory


回答1:


I guess you need just that particular directory and no other changes which were introduced in different branches, if that is the case then, one way which comes to my mind right now is git cherry-pick.

Just check git log and find out the commit id responsible for adding that new directory and everything else you need. Now checkout your other branches one by one and use

git cherry-pick <commid id>

And that particular commit will be applied to that respective branch.




回答2:


I think you need to manually merge the updated branch to rest of the branches. Just commit the directory and other files on one of the branches (say you made the commit on v1.0)

To merge a branch (v.10 to v1.1) you can do

Assume you are on v1.0 branch,

git checkout v1.1
git merge v1.0



回答3:


(assuming you are on branch 1.4) git push origin 1.4

git checkout 1.3 git pull --rebase origin git merge 1.4

Resolve conflicts git add conflicted-file

git commit

git push origin 1.3

Repeat this for all other branches.



来源:https://stackoverflow.com/questions/22439019/git-merge-to-all-branches

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!