I have a commit with 1 ahead
and 6 behind
.
What should I do in this situation?
I think, that solution might be like this: git push
and after git pull
But I think, it can solve only Behind
.
Maybe I am wrong.
-------*------*-----*-----*-----B \ \ \ *-------A
I make my part and change sdk.
Now I want to merge with B
.
A branch can be both ahead and behind at the same time if you have made changes to your branch, and someone else have made changes on the default branch that you have not merged into your branch yet.
To merge branches locally, use git checkout to switch to the branch you want to merge into. This branch is typically the main branch. Next, use git merge and specify the name of the other branch to bring into this branch. This example merges the jeff/feature1 branch into the main branch.
git pull
(or rather, the git merge
part that pull
does) will "solve" both 'ahead' and 'behind'.
branch is X commits behind means that there are X new (unmerged) commits on the branch which is being tracked by your current branch.
branch is X commits ahead analogously means that your branch has X new commits, which haven't been merged into the tracked branch yet.
Once you've pulled (thereby merging the remote changes into your local ones) and pushed (thereby publishing your changes and the merge to the remote), your own branch and the remote branch will point to the same commit, so neither is ahead or behind.
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