The easiest: just stop accepting updates from the source repository. Remove the remote repository from the .git / config file.
Otherwise, from my notes:
Suppose you want to move dir1 from repository A to repository B :
Clone repository A. To be safe, we break the connection between clone and A to make sure that none of our changes are accidentally sent back.
git clone git://git.foo.com/ProjectA.git NewProject cd NewProject git remote rm origin
Delete everything except dir1 .
git filter-branch --subdirectory-filter dir1
This will make dir1 a new root, which you can undo:
mkdir dir1 mv * dir1 git commit -a
Now merge this repository into repository B
git clone git:
source share