Search code examples
gitgit-svngit-commit

How to remove duplicated commits in a git svn tree?


I am working with a SVN server using git SVN. I struggled to created a tag so I had a look at the tree. I noticed that my tree is messed up: all commits appear twice. Once in the red "branch" and once in the purple on:

enter image description here

Before posting this I cleaned a lot of branches using:

git branch -D useless_remote_branch
git gc

But for this one I don't know what to do to get a clean history.

How could I get back to a linear history with only the red "branch"?

I can delete the tag on the SVN side if needed.

Thank you!


EDIT

Here is what I got after the solution suggested by @VonC and a git svn tag command:

enter image description here


Solution

  • If you are sure you have properly deleted the purple branch (both on git and svn), make sure you delete the tag as well (both on git and svn)

    svn rm $URL/tags/the_tag
    git branch -D -r tags/the_tag
    rm -rf .git/svn/tags/the_tag
    

    That way, none of the commits from the purple branch won't be referenced by any commit from the red branch.