The solution is simple:
git filter-branch [options] -- --all
Note the four dashes (two sets of double dashes with a space in between) in -- --all
.
If you look at the docs for git-filter-branch
, it says this:
git filter-branch [--env-filter <command>] [--tree-filter <command>]
[--index-filter <command>] [--parent-filter <command>]
[--msg-filter <command>] [--commit-filter <command>]
[--tag-name-filter <command>] [--subdirectory-filter <directory>]
[--prune-empty]
[--original <namespace>] [-d <directory>] [-f | --force]
[--] [<rev-list options>…]
Reading on, the beginning of the docs say: "Lets you rewrite git revision history by rewriting the branches mentioned in the <rev-list options>, applying custom filters on each revision."
So checking the docs for rev-list
gives:
< rev-list options >… Arguments for git rev-list. All positive refs
included by these options are rewritten. You may also specify options
such as --all, but you must use -- to separate them from the git
filter-branch options.
And the docs for git-rev-list
say:
--all
Pretend as if all the refs in refs/ are listed on the command line as <commit>.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…