summaryrefslogtreecommitdiff
path: root/Documentation/git-filter-branch.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/git-filter-branch.txt')
-rw-r--r--Documentation/git-filter-branch.txt60
1 files changed, 31 insertions, 29 deletions
diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt
index 2b40bab..0f2f117 100644
--- a/Documentation/git-filter-branch.txt
+++ b/Documentation/git-filter-branch.txt
@@ -32,8 +32,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.
+*NOTE*: This command honors `.git/info/grafts` and `.git/refs/replace/`.
+If you have any grafts or replacement refs 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
@@ -81,7 +82,7 @@ OPTIONS
This filter may be used if you only need to modify the environment
in which the commit will be performed. Specifically, you might
want to rewrite the author/committer name/email/time environment
- variables (see linkgit:git-commit[1] for details). Do not forget
+ variables (see linkgit:git-commit-tree[1] for details). Do not forget
to re-export the variables.
--tree-filter <command>::
@@ -116,8 +117,8 @@ OPTIONS
--commit-filter <command>::
This is the filter for performing the commit.
If this filter is specified, it will be called instead of the
- 'git-commit-tree' command, with arguments of the form
- "<TREE_ID> [-p <PARENT_COMMIT_ID>]..." and the log message on
+ 'git commit-tree' command, with arguments of the form
+ "<TREE_ID> [(-p <PARENT_COMMIT_ID>)...]" and the log message on
stdin. The commit id is expected on stdout.
+
As a special extension, the commit filter may emit multiple
@@ -127,10 +128,10 @@ have all of them as parents.
You can use the 'map' convenience function in this filter, and other
convenience functions, too. For example, calling 'skip_commit "$@"'
will leave out the current commit (but not its changes! If you want
-that, use 'git-rebase' instead).
+that, use 'git rebase' instead).
+
-You can also use the 'git_commit_non_empty_tree "$@"' instead of
-'git commit-tree "$@"' if you don't wish to keep commits with a single parent
+You can also use the `git_commit_non_empty_tree "$@"` instead of
+`git commit-tree "$@"` if you don't wish to keep commits with a single parent
and that makes no change to the tree.
--tag-name-filter <command>::
@@ -159,7 +160,7 @@ to other tags will be rewritten to point to the underlying commit.
--subdirectory-filter <directory>::
Only look at the history which touches the given subdirectory.
The result will contain that directory (and only that) as its
- project root.
+ project root. Implies <<Remap_to_ancestor>>.
--prune-empty::
Some kind of filters will generate empty commits, that left the tree
@@ -168,7 +169,7 @@ to other tags will be rewritten to point to the underlying commit.
and only one parent, it will hence keep merges points. Also, this
option is not compatible with the use of '--commit-filter'. Though you
just need to use the function 'git_commit_non_empty_tree "$@"' instead
- of the 'git commit-tree "$@"' idiom in your commit filter to make that
+ of the `git commit-tree "$@"` idiom in your commit filter to make that
happen.
--original <namespace>::
@@ -185,15 +186,26 @@ to other tags will be rewritten to point to the underlying commit.
-f::
--force::
- 'git-filter-branch' refuses to start with an existing temporary
+ 'git filter-branch' refuses to start with an existing temporary
directory or when there are already refs starting with
'refs/original/', unless forced.
<rev-list options>...::
- Arguments for 'git-rev-list'. All positive refs included by
+ 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.
+ the 'git filter-branch' options. Implies <<Remap_to_ancestor>>.
+
+
+[[Remap_to_ancestor]]
+Remap to ancestor
+~~~~~~~~~~~~~~~~~
+
+By using linkgit:rev-list[1] arguments, e.g., path limiters, you can limit the
+set of revisions which get rewritten. However, positive refs on the command
+line are distinguished: we don't let them be excluded by such limiters. For
+this purpose, they are instead rewritten to point at the nearest ancestor that
+was not excluded.
Examples
@@ -210,7 +222,7 @@ However, if the file is absent from the tree of some commit,
a simple `rm filename` will fail for that tree and commit.
Thus you may instead want to use `rm -f filename` as the script.
-Using `\--index-filter` with 'git-rm' yields a significantly faster
+Using `\--index-filter` with 'git rm' yields a significantly faster
version. Like with using `rm filename`, `git rm --cached filename`
will fail if the file is absent from the tree of a commit. If you
want to "completely forget" a file, it does not matter when it entered
@@ -292,7 +304,7 @@ and all children of the merge will become merge commits with P1,P2
as their parents instead of the merge commit.
You can rewrite the commit log messages using `--msg-filter`. For
-example, 'git-svn-id' strings in a repository created by 'git-svn' can
+example, 'git svn-id' strings in a repository created by 'git svn' can
be removed this way:
-------------------------------------------------------
@@ -303,7 +315,7 @@ git filter-branch --msg-filter '
To restrict rewriting to only part of the history, specify a revision
range in addition to the new branch name. The new branch name will
-point to the top-most revision that a 'git-rev-list' of this range
+point to the top-most revision that a 'git rev-list' of this range
will print.
If you need to add 'Acked-by' lines to, say, the last 10 commits (none
@@ -319,7 +331,7 @@ git filter-branch --msg-filter '
*NOTE* the changes introduced by the commits, and which are not reverted
by subsequent commits, will still be in the rewritten branch. If you want
to throw out _changes_ together with the commits, you should use the
-interactive mode of 'git-rebase'.
+interactive mode of 'git rebase'.
Consider this history:
@@ -347,10 +359,10 @@ To move the whole tree into a subdirectory, or remove it from there:
---------------------------------------------------------------
git filter-branch --index-filter \
- 'git ls-files -s | sed "s-\t-&newsubdir/-" |
+ 'git ls-files -s | sed "s-\t\"*-&newsubdir/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &&
- mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
+ mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD
---------------------------------------------------------------
@@ -394,16 +406,6 @@ warned.
(or if your git-gc is not new enough to support arguments to
`\--prune`, use `git repack -ad; git prune` instead).
-
-Author
-------
-Written by Petr "Pasky" Baudis <pasky@suse.cz>,
-and the git list <git@vger.kernel.org>
-
-Documentation
---------------
-Documentation by Petr Baudis and the git list.
-
GIT
---
Part of the linkgit:git[1] suite