I was checking some of the projects in github and in one of them I noticed this:
This branch is 287 commits ahead, 361 commits behind X:Master
How exactly is this possible ?
Just like that:
o ----- ... 285 commits ... -- o <-- master
/
o -- o -- o -- ... 359 commits ... -- o <-- X/master
You created 287 commits on branch master in your local repository. These commits are not accessible from X/master. This is why master is "287 commits ahead X/master".
In the same time, other developers created 361 new commits on X/master. Since the local master and X/master diverged, these 361 commits are not accessible from master and that's why master is "361 commits behind X/master".
This is a normal situation in a versioning control system. You can synchronize your master branch with X/master in two ways:
merge
Run:
git checkout master
git merge X/master
This creates a new commit that contains all the changes from both master and X/master and has two parents: the current tips of the master and X/master branches.
If it succeeds, the graph looks like this:
+--- old "master"
v
o -- ... 285 commits ... -- o -- o <-- master (the merge commit)
/ /
o -- o -- o -- ... 359 commits ... -- o <-- X/master
rebase
Run:
git checkout master
git rebase X/master
This moves all the commits that are on master but not on X/master (the 287 commits that are "ahead") on the X/master branch, after the commits 361 that are on X/master and are not accesible from master.
If it succeeds, the graph will look like this:
+--- old split point
v
o -- o - ... 360 commits ... - o - ... 286 commits ... - o <-- master
^
+---- X/master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With