2

I have been following the Answers to this question Detach subdirectory into separate Git repository and had some good successes with simple Subdirectories that are only on one branch but now I am confronted with a Subdirectory that is littered over multiple branches so a simple

git filter-branch --subdirectory-filter SUBDIRECTORY HEAD

does not do the job.

Do I have to switch into each and every branch and run the filter-branch command or is there something that can do a blanked change through the complete history ?

Community
  • 1
  • 1
AGrunewald
  • 1,735
  • 3
  • 16
  • 25

1 Answers1

7

The HEAD at the end of your command is specifying the ref to process. You can give it any number of other commands, including --all to specify absolutely everything, --branches to specify just branches, or --remotes to specify just remotes. You may have to prefix these options with -- to tell filter-branch that these are rev-list args. Note that --all will try to process tags explicitly, which may not be what you want. You could use --branches --remotes to specify all non-tag refs instead. You may also want to add --tag-name-filter cat to rewrite tags that point to rewritten commits - your original command will leave those tags unchanged.

Lily Ballard
  • 182,031
  • 33
  • 381
  • 347
  • 1
    Thanks I also discovered that you have to keep an eye on the output of filter-branch as it might not rewrite all branches and tags and those that aren't rewritten need to be deleted. – AGrunewald Dec 09 '10 at 19:30