如何保持分叉回购与原始回购同步
How to keep the forked repo synced to original repo
Github 说,"This branch is 10 commits ahead, 8 commits behind xyz:master"
.
如何才能和师傅连起来?
将 master
拉入您的分支 (say, feature
),然后解决“8 commits behind”。如果您将 feature
与 master
合并,那么“提前 10 次提交”将得到解决。
# merge 'master' into 'feature' branch (solve '8 commits behind')
$ git fetch
$ git checkout feature
$ git pull origin master # pull latest commits of master
$ git push origin HEAD # update remote/feature
# merge 'feature' into 'master' branch (solve '10 commits ahead')
$ git checkout master # checkout 'master'
$ git pull origin master # sync with origin/master
$ git pull origin feature # pull latest commits of your branch 'feature'
$ git push origin master # push to remote/master
将两个分支合并在一起
Github 说,"This branch is 10 commits ahead, 8 commits behind xyz:master"
.
如何才能和师傅连起来?
将 master
拉入您的分支 (say, feature
),然后解决“8 commits behind”。如果您将 feature
与 master
合并,那么“提前 10 次提交”将得到解决。
# merge 'master' into 'feature' branch (solve '8 commits behind')
$ git fetch
$ git checkout feature
$ git pull origin master # pull latest commits of master
$ git push origin HEAD # update remote/feature
# merge 'feature' into 'master' branch (solve '10 commits ahead')
$ git checkout master # checkout 'master'
$ git pull origin master # sync with origin/master
$ git pull origin feature # pull latest commits of your branch 'feature'
$ git push origin master # push to remote/master
将两个分支合并在一起