请问派生出来的分支如何同步最新的主分支


#1

我派生一个分支到自己的目录下,如果主分支更新了,我的派生分支如何把主分支的最新代码更新过来


#2
# Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:

git fetch upstream

# Make sure that you're on your master branch:

git checkout master

# Rewrite your master branch so that any commits of yours that
# aren't already in upstream/master are replayed on top of that
# other branch:

git rebase upstream/master

Found here.