X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=Documentation%2Fgit-filter-branch.txt;h=7747c4877de4b7cae352b982c6c1a8b06ca8556d;hb=c6d8f7635f619f6576dccf17c1f1264d2cc37a2a;hp=7ba9dab5e6c0b32f927d24de800e17b71a06b84b;hpb=eb72a51407228c8c7947e762d4f1c320712c9052;p=git.git diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt index 7ba9dab5e..7747c4877 100644 --- a/Documentation/git-filter-branch.txt +++ b/Documentation/git-filter-branch.txt @@ -13,7 +13,7 @@ SYNOPSIS [--msg-filter ] [--commit-filter ] [--tag-name-filter ] [--subdirectory-filter ] [--original ] [-d ] [-f | --force] - [...] + [--] [...] DESCRIPTION ----------- @@ -31,6 +31,9 @@ changes, which would normally have no effect. Nevertheless, this may be useful in the future for compensating for some git bugs or such, therefore such a usage is permitted. +*NOTE*: This command honors `.git/info/grafts`. If you have any grafts +defined, running this command will make them permanent. + *WARNING*! The rewritten history will have different object names for all the objects and will not converge with the original branch. You will not be able to easily push and distribute the rewritten branch on top of the @@ -167,11 +170,11 @@ to other tags will be rewritten to point to the underlying commit. directory or when there are already refs starting with 'refs/original/', unless forced. -:: - When options are given after the new branch name, they will - be passed to 'git-rev-list'. Only commits in the resulting - output will be filtered, although the filtered commits can still - reference parents which are outside of that set. +...:: + 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. Examples @@ -196,6 +199,17 @@ git filter-branch --index-filter 'git rm --cached filename' HEAD Now, you will get the rewritten history saved in HEAD. +To rewrite the repository to look as if `foodir/` had been its project +root, and discard all other history: + +------------------------------------------------------- +git filter-branch --subdirectory-filter foodir -- --all +------------------------------------------------------- + +Thus you can, e.g., turn a library subdirectory into a repository of +its own. Note the `\--` that separates 'filter-branch' options from +revision options, and the `\--all` to rewrite all branches and tags. + To set a commit (which typically is at the tip of another history) to be the parent of the current initial commit, in order to paste the other history behind the current history: