0%

Git 多人协作 的 merge 顺序

Git 多人协作

不开分支多人协作的后果—— git 自动用旧代码覆盖新的更改

主干分支与个人分支的合并

在个人分支 commit 后

1
2
3
4
5
6
7
8
git checkout dev
git pull
git merge --no-ff personal_branch # --no-ff: 禁用 fast forward 模式
# resolve conflict
git push

git checkout personal_branch
git reset --hard dev

merge 和 rebase 的区别

引用知乎的回答:

可以这么说:merge是显性合并,rebase是隐性合并。
同理,当你执行git pull时,是同时执行了git fetch 和 git merge两个操作。如果你不想进行merge操作,即不想留下合并的记录,可以使用 git pull —rebase操作。

SourceTree 下的 merge

  • Aim: merge branchA into main
  1. double click branchA on the side bar of branches.
  2. select the commit and right click, select commit.

Significant: checkout to the branch which is to be merged with. (branchA in this case)

Github Desktop 下的 merge

参考这个,不再赘述。


Reference: