如何从远程分支拉取更新
有远程分支:R
有本地分支:L
(基于R
创建)
所以图是
R--R1---R2--- \ L--L1--
现在,我只是需要保持 L
分支始终拥有来自 R
的更新
我可以做到这一点的最简单方法是什么?
我认为答案是:
- 将更新从本地 R 首先
- 签出到 L 并合并
但这似乎不是很简单,我需要手动进行一些冲突处理。
There is remote branch: R
There is local branch: L
(which was created based on R
)
So the graph is
R--R1---R2--- \ L--L1--
Right now, I just need keep L
branch always have the updates from R
What is the simplest way I can do this?
I think the answer is to:
- pull updates from local R first
- checkout to L and merge
But this does not seem very straightforward and I need do some conflict handling manually.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您想让 L 成为 R 的跟踪分支。您可以使用以下命令来完成此操作。
然后,无论何时您在分支 L 上,只需运行 git pull remote ,它就会提取更新并自动将它们合并到您的存储库中。
https://git-scm.com/book/en/ v2/Git-Branching-远程分支
You want to make L a tracking branch for R. You can do this with the command.
Then, any time you are on branch L, just run
git pull remote
and it will pull updates and automatically merge them into your repository.https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches
您可以直接从 R 拉入 L。假设 L 已签出:
L 不必跟踪分支即可拉入远程更改。
You can pull directly into L from R. Assuming L is checked out:
L doesn't have to be tracking branch for you to pull in remote changes.