Shreyan Mehta
Shreyan Mehta

Reputation: 550

your branch is ahead of origin master by 3 commits

I have already seen this :-

why does it say "Your branch is ahead of origin/master by 857 commits" when I need to *pull* origin master Git - "Your branch is ahead of 'origin/master' by 3 commits." Your branch is ahead of 'origin/master' by 3 commits 'Your branch is ahead of 'origin/master' by 1 commit' on explicit push

I am new to git

but AFAICT it does not solve my issue... the thing is I get this issue often but its like it gets resolved many times by itself after a matter of time, it goes like this:-

$ git status
On branch master
Your branch is ahead of 'github/master' by 3 commits.
(use "git push" to publish your local commits)

nothing to commit, working directory clean

so I checked the github repo all changed has been already pushed...like I also pushed once again to origin/master and still git status shows this.

I also pulled from origin/master... it got successfull in pulling... but after it, it still shows the same after doing git status

Please tell me a good solution to it and also the reason if possible why this is happening... except the reason "Your local Repo is having commits which are not been pushed to remote" thank you in advance

Upvotes: 3

Views: 7045

Answers (1)

Sajib Khan
Sajib Khan

Reputation: 24194

Your branch is ahead of 'github/master' by 3 commits.

Note: your local branch is ahead of github/master not origin/master.

So, you need to push your changes to github/master. Assume you have write permission to github/master (github repo master branch).

$ git remote -v          # you can see the url of 'github' repo    

$ git push github master

Now your local and github/master should be in sync.

$ git status

Upvotes: 3

Related Questions