0

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?

crmpicco
  • 16,605
  • 26
  • 134
  • 210

1 Answers1

2

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

or

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?

Chris Maes
  • 35,025
  • 12
  • 111
  • 136
  • 1
    It's strange that it _does_ push to the repo and create a new branch on the origin even when I don't specify the `-u` flag though. – crmpicco Jun 20 '17 at 10:54