nirvdrum / svn2git

Ruby tool for importing existing svn projects into git.
MIT License
2.11k stars 443 forks source link

--exclude works great, but is there a way to not include the empty commits? #20

Open WilliamDenniss opened 13 years ago

WilliamDenniss commented 13 years ago

NB. I posted this also to stack overflow: http://stackoverflow.com/questions/7067015/svn2git-with-exclude-any-way-to-ignore-the-empty-blank-commits forgive the cross-posting, I really want to know if this is possible, or if I should just live with the blank commits.

I'm converting a big SVN repository into multiple git repositories (one for each project).

I am running svn2git for each repo with all unwanted directories --excluded this works well to keep the tags and branches (I delete all the unrelated tags & branches after the conversion)

The only problem is I have loads of empty commits (commits relating to the excluded directories).

Is there any way to exclude these empty commits during the svn2git process?

This solution is a fine way to remove them after the fact, but filter-branch only affects the current branch, and not all the other branches and tags.

nirvdrum commented 13 years ago

I don't know of a way off-hand, but svn2git is just a wrapper around git-svn. If there's a way to do it with git-svn, we should be able to support it fine.

Another option is to rebase the commits out. But that's a pretty dangerous operation to automate.

amedee commented 9 years ago

I use this after svn2git:

git filter-branch -f --prune-empty --tag-name-filter cat -- --all
git filter-branch -f
git reflog expire --expire=now --all
git gc --prune=now --aggressive

You were looking for -- --all.

amedee commented 9 years ago

I see that the answer is also on StackOverflow, so this issue can be closed. I don't agree that svn2git should do everything. Not everybody may want their empty commits gone.