您可以简化命令:
1.
git fetch
git checkout -b my_branch origin/master
2.
git fetch
git merge origin/master
git fetch
更新您的远程分支,当您不打算在此分支上工作时,通常不需要拥有分支的本地副本。
可以省略--no-ff
after 设置git config --global merge.ff false
。
git help config
说:
merge.ff
By default, Git does not create an extra merge commit when merging
a commit that is a descendant of the current commit. Instead, the
tip of the current branch is fast-forwarded. When set to false,
this variable tells Git to create an extra merge commit in such a
case (equivalent to giving the --no-ff option from the command
line). When set to only, only such fast-forward merges are allowed
(equivalent to giving the --ff-only option from the command line).
请注意,这git pull
只是git fetch
和的组合git merge
。
通常你只想要git pull --rebase
本质上是git fetch
plus git rebase
,并创建一个更清晰的历史。
您的“定期推送”有什么理由吗?如果没有其他人在同一个分支上工作,那会很好,只需在完成所有内容后推送即可。