1

I have to branches, master and bryan.

I have pulled everything to master and rebased it to bryan.

When I make a change in my bryan branch, and try to push it, I get this error message:

hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.

Why do I get this message all the time? I have merged the changes with git rebase.

user500468
  • 1,183
  • 6
  • 21
  • 36

1 Answers1

1
  1. git checkout master
  2. git pull
  3. git checkout bryan
  4. git rebase master

Any git pull includes a git fetch, which will update all remote tracking branches (origin/master and origin/bryan)

You have update master with origin/master, but not bryan with origin/bryan:
Adding a git pull between step 3 and 4 would help there.

But, by rebasing bryan on top of master, you changed its local history.
You would need to force the push (and be careful if other devs were developing from the same bryan branch).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • So in the future, I should do a pull between 3 and 4? And to push my changes I have now, I should do a force push? – user500468 Sep 15 '14 at 09:21
  • @user500468 pull as in http://stackoverflow.com/a/10298391/6309, and force push only for the bryan branch, because a rebase change its history. – VonC Sep 15 '14 at 09:22