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
Checkout the jzbranch branch
git checkout jzbranch
Merge in justin
git merge justin
If there are any conflicts, run
git mergetool
after git mergetool runs, usegit commit
to commit the final merge.
git branch newbranch 6070aada7b8a690d410b
git checkout newbranch
git merge 94943b74ba273a9f4009
精彩评论