How to detach subdirectory in Git but keep all branches
I have been following the Answers to开发者_Go百科 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 ?
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.
精彩评论