I've split a git repo using
$ git clone bigrepo smallrepo
$ cd smallrepo
$ git filter-branch --subdirectory-filter subdir/ master
Now the smallrepo now has the history related to subdir on the master branch, git log
only shows this history, and git branch --all
only lists the master branch. However, in SourceTree, the smallrepo still has history not related to subdir on a separate, unnamed branch.
Questions:
- How do I get rid of this extra history so that smallrepo is a clean repo that only has the history related to subdir?
- Why does this extra history show up in SourceTree but not on the command line?
- Is there a better way to split a git repo?
- (Bonus question) Is there a way to split a git repo by file name rather than subdirectory (the file may have changed subdirectory at some point) and keep the history related to the file?