Code

Start 1.6.1 cycle
[git.git] / Documentation / git-filter-branch.txt
index 4262309b095e4415be88ec20e822757bdaffc1ff..b0e710d5f9c05eb86ce3ccc4e1aa4a7868f3abff 100644 (file)
@@ -13,7 +13,7 @@ SYNOPSIS
        [--msg-filter <command>] [--commit-filter <command>]
        [--tag-name-filter <command>] [--subdirectory-filter <directory>]
        [--original <namespace>] [-d <directory>] [-f | --force]
-       [<rev-list options>...]
+       [--] [<rev-list options>...]
 
 DESCRIPTION
 -----------
@@ -108,7 +108,7 @@ 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
+       '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.
 +
@@ -119,7 +119,7 @@ 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).
 
 --tag-name-filter <command>::
        This is the filter for rewriting tag names. When passed,
@@ -163,15 +163,15 @@ 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>::
-       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.
+<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.
 
 
 Examples
@@ -191,11 +191,22 @@ Thus you may instead want to use `rm -f filename` as the script.
 A significantly faster version:
 
 --------------------------------------------------------------------------
-git filter-branch --index-filter 'git update-index --remove filename' HEAD
+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:
@@ -255,7 +266,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:
 
 -------------------------------------------------------
@@ -266,13 +277,13 @@ 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.
 
 *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: