# Re: branch rebase and push

4 messages from 2006-12-19 to 2006-12-19. Participants: Jakub Narebski, Johannes Schindelin, SungHyun Nam.
Thread: https://gitlist.dev/t/43360

## SungHyun Nam, 2006-12-19 03:39

Subject: branch rebase and push
Message-ID: <45875EFC.5090408@gmail.com>
URL: https://gitlist.dev/e/45875EFC.5090408%40gmail.com

```
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




```

## Jakub Narebski, 2006-12-19 09:57

Subject: Re: branch rebase and push
Message-ID: <em8cti$nff$1@sea.gmane.org>
URL: https://gitlist.dev/e/em8cti%24nff%241%40sea.gmane.org
In-Reply-To: <45875EFC.5090408@gmail.com>

```
SungHyun Nam wrote:

> 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

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 ;-).

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git


```

## Jakub Narebski, 2006-12-19 11:58

Subject: Re: branch rebase and push
Message-ID: <200612191258.55226.jnareb@gmail.com>
URL: https://gitlist.dev/e/200612191258.55226.jnareb%40gmail.com
In-Reply-To: <4587BD31.9030804@gmail.com>

```
SungHyun Nam wrote:

> 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.
-- 
Jakub Narebski

```

## Johannes Schindelin, 2006-12-19 12:13

Subject: Re: branch rebase and push
Message-ID: <Pine.LNX.4.63.0612191311060.19693@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0612191311060.19693%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <200612191258.55226.jnareb@gmail.com>

```
Hi,

On Tue, 19 Dec 2006, Jakub Narebski wrote:

> SungHyun Nam wrote:
> 
> > 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.

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

```
