Some time ago I converted a massive Subversion repository to git. It’s largely legacy projects that are in storage. I’ve been asked to update one project, and felt it would be best to split that project out into its own git repository.
I was able to find an excellent treatment on stackoverflow here. The following are my notes and observations.
git clone monster-repository project-repository cd project-repository
This creates a working copy that will be manipulated.
git remote rm origin
git tag -l | xargs git tag -d
git filter-branch --tag-name-filter cat --prune-empty --subdirectory-filter project-directory HEAD
git reset --hard git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d git reflog expire --expire=now --all git gc --aggressive --prune=now
git remote add origin [url] git push origin master
I didn’t want to purge the project from the original legacy repository, so I simply deleted the entire project directory, and committed with the message “This directory has been moved to its own git repository found at [url].”.