git branch not showing as ahead of origin after commit



I have a git feature branch which I created from the development branch with:

git checkout -b CRM-feature-branch develop

I then pushed this to he remote with:

git push origin HEAD

When I commit to this branch locally and do a git status it doesn’t show my branch is ahead.

Is this because I created the branch on the origin with git push origin HEAD and not git push origin -u CRM-feature-branch?


in short: yes. If you don’t use --set-upstream (or -u in short), then your local git repository does not know the “remote counterpart” for the branch you are on. You can still fix this using

git push -u origin CRM-feature-branch


git branch --set-upstream CRM-feature-branch origin/CRM-feature-branch

for further reading: Why do I need to do `–set-upstream` all the time?

Answered By – Chris Maes

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More