[PATCH] Documentation: filter-branch: document how to filter all refs
- From
Thomas Rast <trast@student.ethz.ch>
- Date
- Aug 7, 2008, 14:04 UTC
- Message-ID
- <1218117841-27398-1-git-send-email-trast@student.ethz.ch>
- In-Reply-To
- <200808070950.23754.trast@student.ethz.ch>
Document the '--' option that can be used to pass rev-list options (not just arguments), and give an example usage of '-- --all'.
Signed-off-by: Thomas Rast <trast@student.ethz.ch> ---
[This went out to Jan and Junio already, but I forgot to CC the list. Sorry.]
Somehow I'm imagining this is a FAQ. Either way, I remember figuring out this exact example by accident when I first needed it.
Documentation/git-filter-branch.txt | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt index a518ba6..1f0fcec 100644 --- a/Documentation/git-filter-branch.txt +++ b/Documentation/git-filter-branch.txt @@ -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 ----------- @@ -196,6 +196,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:
-- 1.6.0.rc1.106.g98a7