Skip to content

Instantly share code, notes, and snippets.

@timfel
Created October 29, 2010 10:35
Show Gist options
  • Save timfel/653309 to your computer and use it in GitHub Desktop.
Save timfel/653309 to your computer and use it in GitHub Desktop.
Simple script to convert svn subtrees to git from a git-svn repo (with all branches)
function filter_git_repo ()
{
cd ../../GitRepos/$1;
git filter-branch --subdirectory-filter $1 -- --all;
cd ../../reporting_branch/cockpit/
}
function push_git_repo ()
{
git push $1 --all
}
function add_git_repo ()
{
git remote add $1 ../../GitRepos/$1;
mkdir -p ../../GitRepos/$1;
cd ../../GitRepos/$1;
git init --bare;
cd ../../reporting_branch/cockpit/
}
function convert_subdirectory_to_git_repo ()
{
add_git_repo $1
push_git_repo $1
filter_git_repo $1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment