Skip to contentSkip to conversation

branch rebase and push

DISCUSSION SungHyun Nam 3 participants 4 messages Aug 11, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello,

Can I push a branch after rebase?
I got a error message:
error: remote 'refs/heads/br' is not a strict subset of local ref 'refs/heads/br'. maybe you are not up-to-date and need to pull first?

It worked fine if I did:

  $ git checkout -b br
  $ git pull . master
  $ git checkout master
  $ git pull
  $ git push

But I got above error message if I did:

  $ git checkout br
  $ git rebase master
  $ git checkout master
  $ git pull
  $ git push

Thanks.
namsh

#1 lore raw
Quoted 12 lines · SungHyun Nam

Can I push a branch after rebase?
I got a error message:
error: remote 'refs/heads/br' is not a strict subset of local ref 'refs/heads/br'. maybe you are not up-to-date and need to pull first?

It worked fine if I did:

  $ git checkout -b br
  $ git pull . master
  $ git checkout master
  $ git pull
  $ git push
Quoted 6 lines

But I got above error message if I did:

  $ git checkout br
  $ git rebase master
  $ git checkout master
  $ git pull
  $ git push

The problem you have is with _push_, not branch, I think.

Does repository you pull from has rebased branch 'br'? If yes, is it pulled with + in pull/fetch line? Perhaps (but read documentation first, please) "git push --force" is what you want, provided that other side doesn't forbid non fast-forward pushes.

Bu you usually don't rebase published branch (don't change history of published branch). Equivalently, you don't publish rebased branch until it is ready (or merged in ;-).

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 3 lines · SungHyun Nam

I'm sorry... but could you teach me how I publish the rebased branch? I think Junio does it for 'pu' branch.
Is there recommended workflow? I cannot find.

Either have "Push:+refs/heads/br:refs/heads/br" in your .git/remotes/<name> file, or it's equivalent config file version, with '+' denoting that this branch sometimes does not fast-forward.

Or use git push with --force option when you had rebased.

And of course the server you push to has to not have config variable receive.denyNonFastForwards set to true.

Signature · 1 line
Jakub Narebski
#4 lore raw

Hi,

Quoted 11 lines · Jakub Narebski
Quoted 3 lines · SungHyun Nam

I'm sorry... but could you teach me how I publish the rebased branch? I think Junio does it for 'pu' branch.
Is there recommended workflow? I cannot find.

Either have "Push:+refs/heads/br:refs/heads/br" in your .git/remotes/<name> file, or it's equivalent config file version, with '+' denoting that this branch sometimes does not fast-forward.

Quoted 4 lines

Or use git push with --force option when you had rebased.

And of course the server you push to has to not have config variable receive.denyNonFastForwards set to true.

If that is the case, there is a work-around, which happens to be also nice to tracking parties:

	$ git pull -s ours <remote> <branch>
	$ git push <remote> <branch>

The disadvantage (which I'd argue is actually an advantage) is that you do not lose history. After all: "those who do not learn from history are doomed to repeat it".

Ciao,
Dscho