git - Update a fork with new commits on its master branch? -
i forked branch , created b. now, has been updated others , i'd bring commits on b fork, can ensure stuff i've been doing there still works new content.
how can this? git's terminology (pull, fetch, merge, etc.) hugely unintuitive, @ least on :(
i advise (if none has pulled b):
what have branch a
new evolution , possible commits done in upstream repo:
a--a--a (origin/a) / a--a--a \ b--b--b (b, local branch)
first make sure a
up-to-date upstream repo content: origin/a
:
git checkout git pull
that give you:
a--a--a--a--a--a (a, origin/a) \ b--b--b (b, local branch)
then rebase local modifications done on b
on top of a
(i suppose here a
has upstream branch, meaning it track origin/a
, can check git branch -avvv
)
git checkout b git rebase
which gives you:
a--a--a--a--a--a (a, origin/a) \ b'--b'--b' (b, local branch)
note changes history of b
, if b
pushed, have push --force origin b
, can dangerous if others started working on b
.
see (for more on rebase tricks):
note: "fork branch" isn't recommended expression, since fork more commonly used refer cloned repo on server side: see "git fork git clone?".
instead, say: "i branched a
, created b
": operation "branching" (not "forking").
Comments
Post a Comment