Reputation: 127723
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:
But this does not seem very straightforward and I need do some conflict handling manually.
Upvotes: 3
Views: 332
Reputation: 6136
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
Upvotes: 2
Reputation: 133008
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.
Upvotes: 1