赞
踩
The different is to rebase on your local master, or the one of origin. It's likely that your local master is behind origin/master, but it could be also forward or even has different histories (not recommend)
If your master
is the same as origin/master
, it doesn't matter which one to use.
We rebase (and branch) from origin/master
so we don't have to update our local master. (no need to do git pull
on the local master
branch).
If you rebase on local master, you could do:
- git checkout master // 切换到本地master分支
- git pull origin master // git pull <remoteName> <branchName>, 拉取远程master分支并更新本地
- git checkout branchA // 切换到本地branchA分支
- git rebase master // 变基,将本地master最新的代码合进本地的branchA分支。完成后,本地的branchA分支是最新的
if you rebase on origin/master, you could do:
- git fetch // download objects and refs from another repository
-
- git rebase origin/master // 将远端master最新的代码合进本地的branchA分支。
so a lot shorter.
For even shorter, you could also use "pulled rebase", that one is nicely to combine with the "origin rebase":
git pull origin master --rebase
No need to fetch then.
参考文献:https://stackoverflow.com/questions/45920951/when-use-rebase-master-or-origin-master
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。