[--index-filter <command>] [--parent-filter <command>]\r
[--msg-filter <command>] [--commit-filter <command>]\r
[--tag-name-filter <command>] [--subdirectory-filter <directory>]\r
- [-d <directory>] <new-branch-name> [<rev-list options>…]</div></div>\r
+ [-d <directory>] [-f | --force] [<rev-list options>…]</div></div>\r
</div>\r
<h2>DESCRIPTION</h2>\r
<div class="sectionbody">\r
<p>The command takes the new branch name as a mandatory argument and\r
the filters as optional arguments. If you specify no filters, the\r
commits will be recommitted without any changes, which would normally\r
-have no effect and result in the new branch pointing to the same\r
-branch as your current branch. Nevertheless, this may be useful in\r
-the future for compensating for some git bugs or such, therefore\r
-such a usage is permitted.</p>\r
+have no effect. Nevertheless, this may be useful in the future for\r
+compensating for some git bugs or such, therefore such a usage is\r
+permitted.</p>\r
<p><strong>WARNING</strong>! The rewritten history will have different object names for all\r
the objects and will not converge with the original branch. You will not\r
be able to easily push and distribute the rewritten branch on top of the\r
original branch. Please do not use this command if you do not know the\r
full implications, and avoid using it anyway, if a simple single commit\r
would suffice to fix your problem.</p>\r
-<p>Always verify that the rewritten version is correct before disposing\r
-the original branch.</p>\r
+<p>Always verify that the rewritten version is correct: The original refs,\r
+if different from the rewritten ones, will be stored in the namespace\r
+<em>refs/original/</em>.</p>\r
<p>Note that since this operation is extensively I/O expensive, it might\r
be a good idea to redirect the temporary directory off-disk, e.g. on\r
tmpfs. Reportedly the speedup is very noticeable.</p>\r
</p>\r
</dd>\r
<dt>\r
+-f\|--force\r
+</dt>\r
+<dd>\r
+<p>\r
+ <tt>git filter-branch</tt> refuses to start with an existing temporary\r
+ directory or when there are already refs starting with\r
+ <em>refs/original/</em>, unless forced.\r
+</p>\r
+</dd>\r
+<dt>\r
<rev-list-options>\r
</dt>\r
<dd>\r
or copyright violation) from all commits:</p>\r
<div class="listingblock">\r
<div class="content">\r
-<pre><tt>git filter-branch --tree-filter 'rm filename' newbranch</tt></pre>\r
+<pre><tt>git filter-branch --tree-filter 'rm filename' HEAD</tt></pre>\r
</div></div>\r
<p>A significantly faster version:</p>\r
<div class="listingblock">\r
<div class="content">\r
-<pre><tt>git filter-branch --index-filter 'git update-index --remove filename' newbranch</tt></pre>\r
+<pre><tt>git filter-branch --index-filter 'git update-index --remove filename' HEAD</tt></pre>\r
</div></div>\r
<p>Now, you will get the rewritten history saved in the branch <em>newbranch</em>\r
(your current branch is left untouched).</p>\r
order to paste the other history behind the current history:</p>\r
<div class="listingblock">\r
<div class="content">\r
-<pre><tt>git filter-branch --parent-filter 'sed "s/^\$/-p <graft-id>/"' newbranch</tt></pre>\r
+<pre><tt>git filter-branch --parent-filter 'sed "s/^\$/-p <graft-id>/"' HEAD</tt></pre>\r
</div></div>\r
<p>(if the parent string is empty - therefore we are dealing with the\r
initial commit - add graftcommit as a parent). Note that this assumes\r
<div class="listingblock">\r
<div class="content">\r
<pre><tt>git filter-branch --parent-filter \\r
- 'cat; test $GIT_COMMIT = <commit-id> && echo "-p <graft-id>"' newbranch</tt></pre>\r
+ 'cat; test $GIT_COMMIT = <commit-id> && echo "-p <graft-id>"' HEAD</tt></pre>\r
</div></div>\r
<p>or even simpler:</p>\r
<div class="listingblock">\r
<div class="content">\r
<pre><tt>echo "$commit-id $graft-id" >> .git/info/grafts\r
-git filter-branch newbranch $graft-id..</tt></pre>\r
+git filter-branch $graft-id..HEAD</tt></pre>\r
</div></div>\r
<p>To remove commits authored by "Darl McBribe" from the history:</p>\r
<div class="listingblock">\r
done;\r
else\r
git commit-tree "$@";\r
- fi' newbranch</tt></pre>\r
+ fi' HEAD</tt></pre>\r
</div></div>\r
<p>The shift magic first throws away the tree id and then the -p\r
parameters. Note that this handles merges properly! In case Darl\r
<p>To rewrite only commits D,E,F,G,H, but leave A, B and C alone, use:</p>\r
<div class="listingblock">\r
<div class="content">\r
-<pre><tt>git filter-branch ... new-H C..H</tt></pre>\r
+<pre><tt>git filter-branch ... C..H</tt></pre>\r
</div></div>\r
<p>To rewrite commits E,F,G,H, use one of these:</p>\r
<div class="listingblock">\r
<div class="content">\r
-<pre><tt>git filter-branch ... new-H C..H --not D\r
-git filter-branch ... new-H D..H --not C</tt></pre>\r
+<pre><tt>git filter-branch ... C..H --not D\r
+git filter-branch ... D..H --not C</tt></pre>\r
</div></div>\r
<p>To move the whole tree into a subdirectory, or remove it from there:</p>\r
<div class="listingblock">\r
'git ls-files -s | sed "s-\t-&newsubdir/-" |\r
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \\r
git update-index --index-info &&\r
- mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' directorymoved</tt></pre>\r
+ mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD</tt></pre>\r
</div></div>\r
</div>\r
<h2>Author</h2>\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 19-Jul-2007 02:09:40 UTC\r
+Last updated 24-Jul-2007 08:10:04 UTC\r
</div>\r
</div>\r
</body>\r
[--index-filter <command>] [--parent-filter <command>]
[--msg-filter <command>] [--commit-filter <command>]
[--tag-name-filter <command>] [--subdirectory-filter <directory>]
- [-d <directory>] <new-branch-name> [<rev-list options>...]
+ [-d <directory>] [-f | --force] [<rev-list options>...]
DESCRIPTION
-----------
The command takes the new branch name as a mandatory argument and
the filters as optional arguments. If you specify no filters, the
commits will be recommitted without any changes, which would normally
-have no effect and result in the new branch pointing to the same
-branch as your current branch. Nevertheless, this may be useful in
-the future for compensating for some git bugs or such, therefore
-such a usage is permitted.
+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.
*WARNING*! The rewritten history will have different object names for all
the objects and will not converge with the original branch. You will not
full implications, and avoid using it anyway, if a simple single commit
would suffice to fix your problem.
-Always verify that the rewritten version is correct before disposing
-the original branch.
+Always verify that the rewritten version is correct: The original refs,
+if different from the rewritten ones, will be stored in the namespace
+'refs/original/'.
Note that since this operation is extensively I/O expensive, it might
be a good idea to redirect the temporary directory off-disk, e.g. on
does this in the '.git-rewrite/' directory but you can override
that choice by this parameter.
+-f\|--force::
+ `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 gitlink:git-rev-list[1]. Only commits in the resulting
or copyright violation) from all commits:
-------------------------------------------------------
-git filter-branch --tree-filter 'rm filename' newbranch
+git filter-branch --tree-filter 'rm filename' HEAD
-------------------------------------------------------
A significantly faster version:
--------------------------------------------------------------------------------
-git filter-branch --index-filter 'git update-index --remove filename' newbranch
--------------------------------------------------------------------------------
+--------------------------------------------------------------------------
+git filter-branch --index-filter 'git update-index --remove filename' HEAD
+--------------------------------------------------------------------------
Now, you will get the rewritten history saved in the branch 'newbranch'
(your current branch is left untouched).
history) to be the parent of the current initial commit, in
order to paste the other history behind the current history:
-------------------------------------------------------------------------
-git filter-branch --parent-filter 'sed "s/^\$/-p <graft-id>/"' newbranch
-------------------------------------------------------------------------
+-------------------------------------------------------------------
+git filter-branch --parent-filter 'sed "s/^\$/-p <graft-id>/"' HEAD
+-------------------------------------------------------------------
(if the parent string is empty - therefore we are dealing with the
initial commit - add graftcommit as a parent). Note that this assumes
history with a single root (that is, no merge without common ancestors
happened). If this is not the case, use:
--------------------------------------------------------------------------------
+--------------------------------------------------------------------------
git filter-branch --parent-filter \
- 'cat; test $GIT_COMMIT = <commit-id> && echo "-p <graft-id>"' newbranch
--------------------------------------------------------------------------------
+ 'cat; test $GIT_COMMIT = <commit-id> && echo "-p <graft-id>"' HEAD
+--------------------------------------------------------------------------
or even simpler:
-----------------------------------------------
echo "$commit-id $graft-id" >> .git/info/grafts
-git filter-branch newbranch $graft-id..
+git filter-branch $graft-id..HEAD
-----------------------------------------------
To remove commits authored by "Darl McBribe" from the history:
done;
else
git commit-tree "$@";
- fi' newbranch
+ fi' HEAD
------------------------------------------------------------------------------
The shift magic first throws away the tree id and then the -p
To rewrite only commits D,E,F,G,H, but leave A, B and C alone, use:
--------------------------------
-git filter-branch ... new-H C..H
+git filter-branch ... C..H
--------------------------------
To rewrite commits E,F,G,H, use one of these:
----------------------------------------
-git filter-branch ... new-H C..H --not D
-git filter-branch ... new-H D..H --not C
+git filter-branch ... C..H --not D
+git filter-branch ... D..H --not C
----------------------------------------
To move the whole tree into a subdirectory, or remove it from there:
'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' directorymoved
+ mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
---------------------------------------------------------------
</dt>\r
<dd>\r
<p>\r
- Write dangling refs into .git/lost-found/commit/ or\r
- .git/lost-found/other/, depending on type.\r
+ Write dangling objects into .git/lost-found/commit/ or\r
+ .git/lost-found/other/, depending on type. If the object is\r
+ a blob, the contents are written into the file, rather than\r
+ its object name.\r
</p>\r
</dd>\r
</dl>\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 19-Jul-2007 02:09:41 UTC\r
+Last updated 24-Jul-2007 08:10:04 UTC\r
</div>\r
</div>\r
</body>\r
Be chatty.
--lost-found::
- Write dangling refs into .git/lost-found/commit/ or
- .git/lost-found/other/, depending on type.
+ Write dangling objects into .git/lost-found/commit/ or
+ .git/lost-found/other/, depending on type. If the object is
+ a blob, the contents are written into the file, rather than
+ its object name.
It tests SHA1 and general object sanity, and it does full tracking of
the resulting reachability and everything else. It prints out any
[ --merge ]\r
[ --reverse ]\r
[ --walk-reflogs ]\r
+ [ --no-walk ] [ --do-walk ]\r
<commit>… [ -- <paths>… ]</div></div>\r
</div>\r
<h2>DESCRIPTION</h2>\r
in packs.\r
</p>\r
</dd>\r
+<dt>\r
+--no-walk\r
+</dt>\r
+<dd>\r
+<p>\r
+ Only show the given revs, but do not traverse their ancestors.\r
+</p>\r
+</dd>\r
+<dt>\r
+--do-walk\r
+</dt>\r
+<dd>\r
+<p>\r
+ Overrides a previous --no-walk.\r
+</p>\r
+</dd>\r
</dl>\r
</div>\r
<h2>PRETTY FORMATS</h2>\r
</div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 22-Jul-2007 09:33:18 UTC\r
+Last updated 24-Jul-2007 08:10:05 UTC\r
</div>\r
</div>\r
</body>\r
[ \--merge ]
[ \--reverse ]
[ \--walk-reflogs ]
+ [ \--no-walk ] [ \--do-walk ]
<commit>... [ \-- <paths>... ]
DESCRIPTION
Only useful with '--objects'; print the object IDs that are not
in packs.
+--no-walk::
+
+ Only show the given revs, but do not traverse their ancestors.
+
+--do-walk::
+
+ Overrides a previous --no-walk.
+
include::pretty-formats.txt[]