Wednesday, May 1, 2013

How to split repository into two repositories

Source of wisdom.

We have infra repository that is have folder git_tool that is going to be new repository now.

State of repository "infra" before split:

Task: move "git_tools" to separate repository "infra_new".

1. Create new repo for "git_tools" only
$ git clone
$ cd infra/
$ git filter-branch --prune-empty --index-filter 'git rm --cached --ignore-unmatch jenkins_checks/* sb-svn2git/* eclipse-compiler-warnings.epf ' HEAD
$ gitk --all
$ git remote add origin
$ git push -u origin --all

2. Remove all history remnants from old "infra" repo:

$ git clone
$ cd infra/
$ git filter-branch --prune-empty --index-filter 'git rm --cached --ignore-unmatch git_tools/*' HEAD
$ gitk --all
$ git push -u origin --all --force