Skip to contentSkip to conversation

How to rebase for git svn?

DISCUSSION Yang Zhang 4 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

Yang Zhang

author
#0 lore raw

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!

Signature · 2 lines
Yang Zhang
http://www.mit.edu/~y_z/
#1 lore raw
Quoted 10 lines · Yang Zhang

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.

Quoted 7 lines

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.

Signature · 1 line
Eric Wong
#2 lore raw
Quoted 5 lines · Eric Wong
Quoted 1 line · Yang Zhang

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'.

Signature · 3 lines
Cheers,

Sverre Rabbelier
#3 lore raw
Quoted 10 lines · Sverre Rabbelier
Quoted 5 lines · Eric Wong
Quoted 1 line · Yang Zhang

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

author
#4 lore raw
Quoted 10 lines · Björn Steinbrink
Quoted 8 lines · Sverre Rabbelier
Quoted 4 lines · Eric Wong
Quoted 1 line · Yang Zhang

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'.

Quoted 8 lines

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

Signature · 2 lines
Yang Zhang
http://www.mit.edu/~y_z/