8
git merge 知识点
source link: https://www.maixj.net/ict/git-merge-24431
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
git merge 知识点
2021年3月12日 / 1次阅读Git
任何时候,你都可以用git merge合并branch,但如果你维护的代码很重要,需要认真编写commit的message,而且不能随意增加新的commit节点,此时就要考虑先git rebase后,在git merge。
如果在git rebase后执行git merge,这种情况不会产生新的commit,merge过程很平滑,这叫Fast-Forword,用国外小姐姐画的这个图来说明:
如果你没有做git rebase,有可能你的git merge就是这样的,看起来就有点不太舒服了:
git log里面就出现了分叉!
git pull命令其实是 git fetch 和 git merge的结合,也许加上--rebase是个更好的选择。
git merge是branch级别的合并,git cherry-pick是commit级别的合并。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK