开发者

How do I merge two Git branches, with specific commit ids, into one branch?

I have two commits:

[branch]: [commit_id]
justin: 94943b74ba273a9f4009
jzbranch: 6070aada7b8a690d410b

How do I merge the two branches, into jzbranch, and resolve any differences betwe开发者_运维问答en the two?


How do I merge two Git branches, with specific commit ids, into one branch?

git checkout jzbranch

git merge [commit_id] jzbranch

or

git merge [commit_id] 6070aada7b8a690d410b

because git allows to merge several branches/commits to one.

Then run git mergetool or simple git status (in second case you only will see conflict files and then you would open these files with any editor you like). I prefer second way.

After that mandatory make new commit


  1. Checkout the jzbranch branch
    git checkout jzbranch

  2. Merge in justin
    git merge justin

  3. If there are any conflicts, run git mergetool after git mergetool runs, use git commit to commit the final merge.


git branch newbranch 6070aada7b8a690d410b
git checkout newbranch
git merge 94943b74ba273a9f4009
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜