18
votes

I have a local git repository created with git svn clone. I make a local branch, make some changes, switch back to master, git svn rebase and if it's all good, I merge my branch back into master. Then the tree looks something like this:

alt text http://img.skitch.com/20090108-cjguu3hcci9x2k17mcftamw8f1.jpg

Sometimes, later when I git svn rebase again and get some remote changes, it loses the fact that a_branch was merged into the mainline and the tree looks like this:

alt text http://img.skitch.com/20090108-kn3bn1qgi5ijw8ja5ijkd75pa3.jpg

Why is that? Can I stop it? Is there an easy way to tell that a branch was merged, or should I delete my branches when I'm done so I don't forget what has and hasn't been merged?

2

2 Answers

22
votes

The git-svn man page recommends that you don't use merge. This is one side effect. Since you are rebasing the branch (git svn rebase is a bit like "git pull --rebase") it effectively rewrites history. It may throw away any local commits that are already upstream in subversion, such as the merge, and keep only those commits that really exist in the svn repository. Since a trivial merge commit of a local branch has no equivalent in SVN, you only commit the "real" changes, so these are the only changes seen in your new rebased master branch.

Ideally your local branch should merge fast-forward only, i.e. no merge commit is generated. If this is not the case, then you should consider rebasing your local branch onto master instead of merging it. That avoids creating a merge commit completely.

0
votes

Because you're going through svn. You're going to lose a lot of information when you do that (you also lose the author, for example).