简体   繁体   English

在 GitHub 上合并拉取请求后如何同步我的本地主分支?

[英]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?将这个“新主”拉下来以更新我的本地存储库以便我的本地目录同步、干净且无需重写任何历史记录的正确过程是什么?

  1. git pull --> essentially does a git fetch then git merge ...into the branch I'm on? git pull --> 本质上是git fetch然后git merge ...进入我所在的分支?
  2. git pull --rebase --> essentially does a git fetch then git rebase ? git pull --rebase --> 本质上是先执行git fetch然后执行git rebase吗?
  3. git fetch then git merge origin/master --> same as option 1? git fetch然后git merge origin/master --> 与选项 1 相同?
  4. 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 pullgit 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.

相关问题 Github,我如何将分支同步到主节点? - Github, how do I sync my branch to the master? Git-拉取请求后,我的本地master分支会怎样? 如何管理多个进行中的分支? - Git - What happens to my local master branch after a pull request? How do I manage multiple in progress branches? 我的拉取请求被拒绝,因为我的主分支不同步。 我如何让它同步? - My pull request is being rejected because my master branch is out of sync. How do I get it in sync? 如何将我的拉取请求基于github中的master? - How do I rebase my pull request onto master in github? 如何在GitHub中只使用我的分叉存储库的主分支中的最新提交来执行拉取请求 - How to do a pull request in GitHub with only the latest commit in the master branch of my forked repository GitHub:请求请求:请求请求后是否必须分支? - GitHub: Pull Requests: do I have to branch after a pull request? 在重新定位和合并到掌握之后,我是否必须(或应该)删除我的本地分支? - Do I have to (or should I) delete my local branch after rebasing and merging to master? GIT:当我已经提交到master分支后,如何发出请求请求? - GIT: How can I do a pull request when I've already commited to my master branch? 如何从主分支向暂存分支发出拉取请求? - How do I make a pull request from the master to the staging branch? 如何在不合并的情况下使git分支成为主节点? - How do I make my git branch into the master without merging?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM