[英]How do I sync my local master branch after merging a pull request on GitHub?
I realize there are many questions on syncing branches, and the difference between git commands, but I am finding it hard to know what is the correct process for this.我知道那里有很多的分支同步的问题,和差之间的git的命令,但我发现很难知道什么是这个正确的过程。
I am the maintainer of a repository on GitHub.我是 GitHub 上一个存储库的维护者。 One of the members on my team cloned the repo, created a new-feature
branch, pushed this new-feature
branch into the GitHub repository, and created a pull request to merge it into master
.我团队的一名成员克隆了这个 repo,创建了一个new-feature
分支,将这个new-feature
分支推送到 GitHub 存储库,并创建了一个拉取请求将其合并到master
。 I approved the pull request and merged it into master
on the GitHub website.我批准了拉取请求并将其合并到 GitHub 网站上的master
。
What is the correct process to pull this 'new master' down to update my local repository so I have my local directory synchronized, cleanly and without re-writing any history?将这个“新主”拉下来以更新我的本地存储库以便我的本地目录同步、干净且无需重写任何历史记录的正确过程是什么?
git pull
--> essentially does a git fetch
then git merge
...into the branch I'm on? git pull
--> 本质上是git fetch
然后git merge
...进入我所在的分支?git pull --rebase
--> essentially does a git fetch
then git rebase
? git pull --rebase
--> 本质上是先执行git fetch
然后执行git rebase
吗?git fetch
then git merge origin/master
--> same as option 1? git fetch
然后git merge origin/master
--> 与选项 1 相同?git fetch
then git rebase origin/master
--> same as option 2? git fetch
然后git rebase origin/master
--> 与选项 2 相同?git pull
or git pull --rebase
are the canonical ways to achieve what you need - sync your local branch with the branch it follows on the server. git pull
或git pull --rebase
是实现您需要的规范方法 - 将您的本地分支与其在服务器上遵循的分支同步。
Generally speaking, if you use pull requests, you don't want to make any direct changes to the master branch - everything should go via branches.一般来说,如果您使用拉取请求,您不想对主分支进行任何直接更改 - 一切都应该通过分支进行。 This strategy (it's not a technical requirement) is a common methodology that teams around choose.这种策略(它不是技术要求)是周围团队选择的常用方法。 One benefit is that you never have merge issues when pulling master.一个好处是你在拉主时永远不会有合并问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.