Importing a Subversion repository with a non-standard layout into Git
I'm trying to (permanently) migrate my group's Subversion repository to Git, but I'm running onto problems trying to clean up its non-standard directory structure.
Some of the project's content is contained in trunk and branches folders, but not all of it. The project on Subversion is laid out like this:
project/trunk/
project/branches/feature_1
project/branches/feature_2
project/libraries
project/crontab
...
After importing, I want the Git repository to be laid out like so:
project/html # the content of the old trunk and branches folders
project/libraries
project/crontab
...
Running svn2git
with the appropriate options will handle the trunk and branches di开发者_JAVA百科rectories correctly, but how can I also include the history for the other folders? It seems like git-filter-branch
could help, but I'm not sure how to use it for this.
Import each main subfolder of your repo into a separate git repo and then use the subtree merging method to merge the git repos into one repo. You may end up with a few duplicate commits though.
If you have many subdirectories you may want to do an svnadmin dump
, then svndumpfilter exclude ..
twice to split your svn repo into two halves and then use the subtree merging method to re-join them. This would have a cleaner history than doing many subtree merges.
精彩评论