Your Git Branch is Ahead of origin/master By n Commits | SJB -->

This website uses cookies to ensure you get the best experience. More info...

Pages

Your Git Branch is Ahead of origin/master By n Commits

You are a friend of git, you might get following error by running git status at some point in your friendship journey.

Your branch is ahead of 'origin/master' by n commits.
Not cool!
Let's fix it.
Git-Branch is Ahead of origin/master By n Commits
Run this to check the very last changes on master.
 
git diff origin/master
The issue is pretty simple though.
The warning is saying that the local master has more stuff than the local copy of the remote master branch origin/master. Your local master branch must have new commits and you need to push your commits to the origin. You did your job, made some changes and now its time to git push origin those changes. Run
 
git push origin
 
git fetch
Or just run
 
git fetch origin
If still the issue remains, you can run the following command to reset the local master and start over. It will discard all the local changes.
 
git reset --hard origin/master

No comments:

Post a Comment