How to pull updates from remote branch
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.
You want to make L a tracking branch for R. You can do this with the command.
git branch --track L remote/R
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
You can pull directly into L from R. Assuming L is checked out:
git pull origin R
L doesn't have to be tracking branch for you to pull in remote changes.
精彩评论