# How to rebase for git svn?

5 messages from 2008-11-05 to 2008-11-06. Participants: Yang Zhang, Eric Wong, Sverre Rabbelier, Björn Steinbrink.
Thread: https://gitlist.dev/t/16185

## Yang Zhang, 2008-11-05 19:09

Subject: How to rebase for git svn?
Message-ID: <4911EF4C.8030703@gmail.com>
URL: https://gitlist.dev/e/4911EF4C.8030703%40gmail.com

```
Hi, I made a git svn repository from an svn repository.  Then I cloned 
the git repository, committed some changes to the clone, and pulled back 
to the original repository.  However, now the original repository gives 
me conflicts whenever I run git svn rebase.  I believe this is because 
git pull treats the other repository's commits as a branch and merges 
them back instead of rebasing them and maintaining the type of linear 
history that is good for playing with svn.  Any hints as to how to fix 
this?  I think the solution is to undo the merge that resulted from the 
pull, but I don't know how to do this.

I wrote a simple script reproducing exactly what's going on (along with 
a transcript of its output).  I tried to make it as simple as possible, 
but it can probably be simplified even more to reproduce the problem:

http://assorted.svn.sourceforge.net/viewvc/assorted/sandbox/trunk/src/git/gitsvn.bash?revision=1057&view=markup

Thanks in advance for any help!
-- 
Yang Zhang
http://www.mit.edu/~y_z/

```

## Eric Wong, 2008-11-06 09:55

Subject: Re: How to rebase for git svn?
Message-ID: <20081106095500.GA9587@untitled>
URL: https://gitlist.dev/e/20081106095500.GA9587%40untitled
In-Reply-To: <4911EF4C.8030703@gmail.com>

```
Yang Zhang <yanghatespam@gmail.com> wrote:
> Hi, I made a git svn repository from an svn repository.  Then I cloned  
> the git repository, committed some changes to the clone, and pulled back  
> to the original repository.  However, now the original repository gives  
> me conflicts whenever I run git svn rebase.  I believe this is because  
> git pull treats the other repository's commits as a branch and merges  
> them back instead of rebasing them and maintaining the type of linear  
> history that is good for playing with svn.  Any hints as to how to fix  
> this?  I think the solution is to undo the merge that resulted from the  
> pull, but I don't know how to do this.
>
> I wrote a simple script reproducing exactly what's going on (along with  
> a transcript of its output).  I tried to make it as simple as possible,  
> but it can probably be simplified even more to reproduce the problem:
>
> http://assorted.svn.sourceforge.net/viewvc/assorted/sandbox/trunk/src/git/gitsvn.bash?revision=1057&view=markup
>
> Thanks in advance for any help!

Hi,

Try passing --rebase or --squash with "git pull" to keep history linear
for SVN.

-- 
Eric Wong

```

## Sverre Rabbelier, 2008-11-06 10:15

Subject: Re: How to rebase for git svn?
Message-ID: <bd6139dc0811060215j1ad7ee0ahd0b568283da06cb@mail.gmail.com>
URL: https://gitlist.dev/e/bd6139dc0811060215j1ad7ee0ahd0b568283da06cb%40mail.gmail.com
In-Reply-To: <20081106095500.GA9587@untitled>

```
On Thu, Nov 6, 2008 at 10:55, Eric Wong <normalperson@yhbt.net> wrote:
> Yang Zhang <yanghatespam@gmail.com> wrote:
>> Thanks in advance for any help!
>
> Try passing --rebase or --squash with "git pull" to keep history linear
> for SVN.

Consider doing the following:
git config alias.repull "pull --rebase"
And then using 'git repull' instead of 'git pull'.

-- 
Cheers,

Sverre Rabbelier

```

## Björn Steinbrink, 2008-11-06 10:24

Subject: Re: How to rebase for git svn?
Message-ID: <20081106102425.GA4192@atjola.homenet>
URL: https://gitlist.dev/e/20081106102425.GA4192%40atjola.homenet
In-Reply-To: <bd6139dc0811060215j1ad7ee0ahd0b568283da06cb@mail.gmail.com>

```
On 2008.11.06 11:15:21 +0100, Sverre Rabbelier wrote:
> On Thu, Nov 6, 2008 at 10:55, Eric Wong <normalperson@yhbt.net> wrote:
> > Yang Zhang <yanghatespam@gmail.com> wrote:
> >> Thanks in advance for any help!
> >
> > Try passing --rebase or --squash with "git pull" to keep history linear
> > for SVN.
> 
> Consider doing the following:
> git config alias.repull "pull --rebase"
> And then using 'git repull' instead of 'git pull'.

Or set branch.<name>.rebase in your config and just use "git pull" ;-)
Setting branch.autosetuprebase might also be useful in that case.

You should be careful to make sure that the other side does not lag
behind WRT svn, though. Otherwise, you end up rebasing commits that
corresponds to svn revisions. Bad.

Björn

```

## Yang Zhang, 2008-11-06 20:05

Subject: Re: How to rebase for git svn?
Message-ID: <49134E1A.9090908@gmail.com>
URL: https://gitlist.dev/e/49134E1A.9090908%40gmail.com
In-Reply-To: <20081106102425.GA4192@atjola.homenet>

```
Björn Steinbrink wrote:
> On 2008.11.06 11:15:21 +0100, Sverre Rabbelier wrote:
>> On Thu, Nov 6, 2008 at 10:55, Eric Wong <normalperson@yhbt.net> wrote:
>>> Yang Zhang <yanghatespam@gmail.com> wrote:
>>>> Thanks in advance for any help!
>>> Try passing --rebase or --squash with "git pull" to keep history linear
>>> for SVN.
>> Consider doing the following:
>> git config alias.repull "pull --rebase"
>> And then using 'git repull' instead of 'git pull'.
> 
> Or set branch.<name>.rebase in your config and just use "git pull" ;-)
> Setting branch.autosetuprebase might also be useful in that case.
> 
> You should be careful to make sure that the other side does not lag
> behind WRT svn, though. Otherwise, you end up rebasing commits that
> corresponds to svn revisions. Bad.
> 
> Björn

git pull --rebase doesn't seem to be working either....

http://assorted.svn.sourceforge.net/viewvc/assorted/sandbox/trunk/src/git/gitsvn.bash?revision=1064&view=markup
-- 
Yang Zhang
http://www.mit.edu/~y_z/

```
