path: root/Documentation/git-filter-branch.txt
diff options
authorThomas Rast <>2009-11-10 21:04:51 (GMT)
committerJunio C Hamano <>2009-11-13 19:26:43 (GMT)
commitf2f3a6b802e3dae09a1c414cd8516ff2a546a527 (patch)
treeca23c536248b2861bca602b5b6d5c32863a8f7a2 /Documentation/git-filter-branch.txt
parent2c1d2d818895d896f706835142a75978aabdbdc9 (diff)
filter-branch: nearest-ancestor rewriting outside subdir filter
Since a0e4639 (filter-branch: fix ref rewriting with --subdirectory-filter, 2008-08-12) git-filter-branch has done nearest-ancestor rewriting when using a --subdirectory-filter. However, that rewriting strategy is also a useful building block in other tasks. For example, if you want to split out a subset of files from your history, you would typically call git filter-branch -- <refs> -- <files> But this fails for all refs that do not point directly to a commit that affects <files>, because their referenced commit will not be rewritten and the ref remains untouched. The code was already there for the --subdirectory-filter case, so just introduce an option that enables it independently. Signed-off-by: Thomas Rast <> Signed-off-by: Johannes Sixt <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'Documentation/git-filter-branch.txt')
1 files changed, 12 insertions, 1 deletions
diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt
index 2b40bab..394a77a 100644
--- a/Documentation/git-filter-branch.txt
+++ b/Documentation/git-filter-branch.txt
@@ -159,7 +159,18 @@ 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.
+ Rewrite refs to the nearest rewritten ancestor instead of
+ ignoring them.
+Normally, positive refs on the command line are only changed if the
+commit they point to was rewritten. However, you can limit the extent
+of this rewriting by using linkgit:rev-list[1] arguments, e.g., path
+limiters. Refs pointing to such excluded commits would then normally
+be ignored. With this option, they are instead rewritten to point at
+the nearest ancestor that was not excluded.
Some kind of filters will generate empty commits, that left the tree