1

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?
Cœur
  • 37,241
  • 25
  • 195
  • 267
mrclary
  • 489
  • 3
  • 16
  • Well, I found a solution that worked for me [here](http://stackoverflow.com/questions/17901588/new-repo-with-copied-history-of-only-currently-tracked-files). However, it takes a different approach by first deleting all the file in the repo and then restoring only those files that I want to keep. Since this only addresses my 3rd question (subjectively), I won't "answer my own question". – mrclary Jun 23 '16 at 01:08

0 Answers0