summaryrefslogtreecommitdiffstats
path: root/git-filter-branch.html
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-10-31 13:25:53 -0700
committerJunio C Hamano <gitster@pobox.com>2014-10-31 13:25:53 -0700
commitc14e6ad9a230ad90c84b7f620d87fbe49a2d0342 (patch)
tree120346dc383e3d1c4219fe8c533eb22cb6af2b55 /git-filter-branch.html
parent2a4bcbc355496c8d83b1b9f8892c4cbe8f584158 (diff)
downloadgit-htmldocs-c14e6ad9a230ad90c84b7f620d87fbe49a2d0342.tar.gz
Autogenerated HTML docs for v2.2.0-rc0
Diffstat (limited to 'git-filter-branch.html')
-rw-r--r--git-filter-branch.html142
1 files changed, 70 insertions, 72 deletions
diff --git a/git-filter-branch.html b/git-filter-branch.html
index dbcf7a68e..32ea25765 100644
--- a/git-filter-branch.html
+++ b/git-filter-branch.html
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
-<meta name="generator" content="AsciiDoc 8.6.6" />
+<meta name="generator" content="AsciiDoc 8.6.9" />
<title>git-filter-branch(1)</title>
<style type="text/css">
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
@@ -87,10 +87,16 @@ ul, ol, li > p {
ul > li { color: #aaa; }
ul > li > * { color: black; }
-pre {
+.monospaced, code, pre {
+ font-family: "Courier New", Courier, monospace;
+ font-size: inherit;
+ color: navy;
padding: 0;
margin: 0;
}
+pre {
+ white-space: pre-wrap;
+}
#author {
color: #527bbd;
@@ -219,7 +225,7 @@ div.exampleblock > div.content {
}
div.imageblock div.content { padding-left: 0; }
-span.image img { border-style: none; }
+span.image img { border-style: none; vertical-align: text-bottom; }
a.image:visited { color: white; }
dl {
@@ -349,7 +355,7 @@ div.colist td img {
margin-bottom: 0.1em;
}
-div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
@@ -407,18 +413,14 @@ span.underline { text-decoration: underline; }
span.overline { text-decoration: overline; }
span.line-through { text-decoration: line-through; }
+div.unbreakable { page-break-inside: avoid; }
+
/*
* xhtml11 specific
*
* */
-tt {
- font-family: monospace;
- font-size: inherit;
- color: navy;
-}
-
div.tableblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
@@ -452,12 +454,6 @@ div.tableblock > table[frame="vsides"] {
*
* */
-.monospaced {
- font-family: monospace;
- font-size: inherit;
- color: navy;
-}
-
table.tableblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
@@ -537,6 +533,8 @@ body.manpage div.sectionbody {
@media print {
body.manpage div#toc { display: none; }
}
+
+
</style>
<script type="text/javascript">
/*<![CDATA[*/
@@ -581,7 +579,7 @@ toc: function (toclevels) {
function tocEntries(el, toclevels) {
var result = new Array;
- var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
+ var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
// Function that scans the DOM tree for header elements (the DOM2
// nodeIterator API would be a better technique but not supported by all
// browsers).
@@ -610,7 +608,7 @@ toc: function (toclevels) {
var i;
for (i = 0; i < toc.childNodes.length; i++) {
var entry = toc.childNodes[i];
- if (entry.nodeName == 'div'
+ if (entry.nodeName.toLowerCase() == 'div'
&& entry.getAttribute("class")
&& entry.getAttribute("class").match(/^toclevel/))
tocEntriesToRemove.push(entry);
@@ -656,7 +654,7 @@ footnotes: function () {
var entriesToRemove = [];
for (i = 0; i < noteholder.childNodes.length; i++) {
var entry = noteholder.childNodes[i];
- if (entry.nodeName == 'div' && entry.getAttribute("class") == "footnote")
+ if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
entriesToRemove.push(entry);
}
for (i = 0; i < entriesToRemove.length; i++) {
@@ -776,8 +774,8 @@ If you specify no filters, the commits will be recommitted without any
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.</p></div>
-<div class="paragraph"><p><strong>NOTE</strong>: This command honors <tt>.git/info/grafts</tt> file and refs in
-the <tt>refs/replace/</tt> namespace.
+<div class="paragraph"><p><strong>NOTE</strong>: This command honors <code>.git/info/grafts</code> file and refs in
+the <code>refs/replace/</code> namespace.
If you have any grafts or replacement refs defined, running this command
will make them permanent.</p></div>
<div class="paragraph"><p><strong>WARNING</strong>! The rewritten history will have different object names for all
@@ -852,8 +850,8 @@ multiple commits.</p></div>
<p>
This is the filter for rewriting the index. It is similar to the
tree filter but does not check out the tree, which makes it much
- faster. Frequently used with <tt>git rm --cached
- --ignore-unmatch ...</tt>, see EXAMPLES below. For hairy
+ faster. Frequently used with <code>git rm --cached
+ --ignore-unmatch ...</code>, see EXAMPLES below. For hairy
cases, see <a href="git-update-index.html">git-update-index(1)</a>.
</p>
</dd>
@@ -899,8 +897,8 @@ have all of them as parents.</p></div>
convenience functions, too. For example, calling <em>skip_commit "$@"</em>
will leave out the current commit (but not its changes! If you want
that, use <em>git rebase</em> instead).</p></div>
-<div class="paragraph"><p>You can also use the <tt>git_commit_non_empty_tree "$@"</tt> instead of
-<tt>git commit-tree "$@"</tt> if you don&#8217;t wish to keep commits with a single parent
+<div class="paragraph"><p>You can also use the <code>git_commit_non_empty_tree "$@"</code> instead of
+<code>git commit-tree "$@"</code> if you don&#8217;t wish to keep commits with a single parent
and that makes no change to the tree.</p></div>
</dd>
<dt class="hdlist1">
@@ -950,7 +948,7 @@ to other tags will be rewritten to point to the underlying commit.</p></div>
and only one parent, it will hence keep merges points. Also, this
option is not compatible with the use of <em>--commit-filter</em>. Though you
just need to use the function <em>git_commit_non_empty_tree "$@"</em> instead
- of the <tt>git commit-tree "$@"</tt> idiom in your commit filter to make that
+ of the <code>git commit-tree "$@"</code> idiom in your commit filter to make that
happen.
</p>
</dd>
@@ -1018,36 +1016,36 @@ was not excluded.</p></div>
or copyright violation) from all commits:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>git filter-branch --tree-filter 'rm filename' HEAD</tt></pre>
+<pre><code>git filter-branch --tree-filter 'rm filename' HEAD</code></pre>
</div></div>
<div class="paragraph"><p>However, if the file is absent from the tree of some commit,
-a simple <tt>rm filename</tt> will fail for that tree and commit.
-Thus you may instead want to use <tt>rm -f filename</tt> as the script.</p></div>
-<div class="paragraph"><p>Using <tt>--index-filter</tt> with <em>git rm</em> yields a significantly faster
-version. Like with using <tt>rm filename</tt>, <tt>git rm --cached filename</tt>
+a simple <code>rm filename</code> will fail for that tree and commit.
+Thus you may instead want to use <code>rm -f filename</code> as the script.</p></div>
+<div class="paragraph"><p>Using <code>--index-filter</code> with <em>git rm</em> yields a significantly faster
+version. Like with using <code>rm filename</code>, <code>git rm --cached filename</code>
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
-history, so we also add <tt>--ignore-unmatch</tt>:</p></div>
+history, so we also add <code>--ignore-unmatch</code>:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD</tt></pre>
+<pre><code>git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD</code></pre>
</div></div>
<div class="paragraph"><p>Now, you will get the rewritten history saved in HEAD.</p></div>
-<div class="paragraph"><p>To rewrite the repository to look as if <tt>foodir/</tt> had been its project
+<div class="paragraph"><p>To rewrite the repository to look as if <code>foodir/</code> had been its project
root, and discard all other history:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>git filter-branch --subdirectory-filter foodir -- --all</tt></pre>
+<pre><code>git filter-branch --subdirectory-filter foodir -- --all</code></pre>
</div></div>
<div class="paragraph"><p>Thus you can, e.g., turn a library subdirectory into a repository of
-its own. Note the <tt>--</tt> that separates <em>filter-branch</em> options from
-revision options, and the <tt>--all</tt> to rewrite all branches and tags.</p></div>
+its own. Note the <code>--</code> that separates <em>filter-branch</em> options from
+revision options, and the <code>--all</code> to rewrite all branches and tags.</p></div>
<div class="paragraph"><p>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:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>git filter-branch --parent-filter 'sed "s/^\$/-p &lt;graft-id&gt;/"' HEAD</tt></pre>
+<pre><code>git filter-branch --parent-filter 'sed "s/^\$/-p &lt;graft-id&gt;/"' HEAD</code></pre>
</div></div>
<div class="paragraph"><p>(if the parent string is empty - which happens when we are dealing with
the initial commit - add graftcommit as a parent). Note that this assumes
@@ -1055,30 +1053,30 @@ history with a single root (that is, no merge without common ancestors
happened). If this is not the case, use:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>git filter-branch --parent-filter \
- 'test $GIT_COMMIT = &lt;commit-id&gt; &amp;&amp; echo "-p &lt;graft-id&gt;" || cat' HEAD</tt></pre>
+<pre><code>git filter-branch --parent-filter \
+ 'test $GIT_COMMIT = &lt;commit-id&gt; &amp;&amp; echo "-p &lt;graft-id&gt;" || cat' HEAD</code></pre>
</div></div>
<div class="paragraph"><p>or even simpler:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>echo "$commit-id $graft-id" &gt;&gt; .git/info/grafts
-git filter-branch $graft-id..HEAD</tt></pre>
+<pre><code>echo "$commit-id $graft-id" &gt;&gt; .git/info/grafts
+git filter-branch $graft-id..HEAD</code></pre>
</div></div>
<div class="paragraph"><p>To remove commits authored by "Darl McBribe" from the history:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>git filter-branch --commit-filter '
+<pre><code>git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_NAME" = "Darl McBribe" ];
then
skip_commit "$@";
else
git commit-tree "$@";
- fi' HEAD</tt></pre>
+ fi' HEAD</code></pre>
</div></div>
<div class="paragraph"><p>The function <em>skip_commit</em> is defined as follows:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>skip_commit()
+<pre><code>skip_commit()
{
shift;
while [ -n "$1" ];
@@ -1087,7 +1085,7 @@ git filter-branch $graft-id..HEAD</tt></pre>
map "$1";
shift;
done;
-}</tt></pre>
+}</code></pre>
</div></div>
<div class="paragraph"><p>The shift magic first throws away the tree id and then the -p
parameters. Note that this handles merges properly! In case Darl
@@ -1098,31 +1096,31 @@ as their parents instead of the merge commit.</p></div>
by subsequent commits, will still be in the rewritten branch. If you want
to throw out <em>changes</em> together with the commits, you should use the
interactive mode of <em>git rebase</em>.</p></div>
-<div class="paragraph"><p>You can rewrite the commit log messages using <tt>--msg-filter</tt>. For
+<div class="paragraph"><p>You can rewrite the commit log messages using <code>--msg-filter</code>. For
example, <em>git svn-id</em> strings in a repository created by <em>git svn</em> can
be removed this way:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>git filter-branch --msg-filter '
+<pre><code>git filter-branch --msg-filter '
sed -e "/^git-svn-id:/d"
-'</tt></pre>
+'</code></pre>
</div></div>
<div class="paragraph"><p>If you need to add <em>Acked-by</em> lines to, say, the last 10 commits (none
of which is a merge), use this command:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>git filter-branch --msg-filter '
+<pre><code>git filter-branch --msg-filter '
cat &amp;&amp;
echo "Acked-by: Bugs Bunny &lt;bunny@bugzilla.org&gt;"
-' HEAD~10..HEAD</tt></pre>
+' HEAD~10..HEAD</code></pre>
</div></div>
-<div class="paragraph"><p>The <tt>--env-filter</tt> option can be used to modify committer and/or author
+<div class="paragraph"><p>The <code>--env-filter</code> option can be used to modify committer and/or author
identity. For example, if you found out that your commits have the wrong
identity due to a misconfigured user.email, you can make a correction,
before publishing the project, like this:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>git filter-branch --env-filter '
+<pre><code>git filter-branch --env-filter '
if test "$GIT_AUTHOR_EMAIL" = "root@localhost"
then
GIT_AUTHOR_EMAIL=john@example.com
@@ -1133,7 +1131,7 @@ before publishing the project, like this:</p></div>
GIT_COMMITTER_EMAIL=john@example.com
export GIT_COMMITTER_EMAIL
fi
-' -- --all</tt></pre>
+' -- --all</code></pre>
</div></div>
<div class="paragraph"><p>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
@@ -1142,29 +1140,29 @@ will print.</p></div>
<div class="paragraph"><p>Consider this history:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt> D--E--F--G--H
+<pre><code> D--E--F--G--H
/ /
-A--B-----C</tt></pre>
+A--B-----C</code></pre>
</div></div>
<div class="paragraph"><p>To rewrite only commits D,E,F,G,H, but leave A, B and C alone, use:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>git filter-branch ... C..H</tt></pre>
+<pre><code>git filter-branch ... C..H</code></pre>
</div></div>
<div class="paragraph"><p>To rewrite commits E,F,G,H, use one of these:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>git filter-branch ... C..H --not D
-git filter-branch ... D..H --not C</tt></pre>
+<pre><code>git filter-branch ... C..H --not D
+git filter-branch ... D..H --not C</code></pre>
</div></div>
<div class="paragraph"><p>To move the whole tree into a subdirectory, or remove it from there:</p></div>
<div class="listingblock">
<div class="content">
-<pre><tt>git filter-branch --index-filter \
+<pre><code>git filter-branch --index-filter \
'git ls-files -s | sed "s-\t\"*-&amp;newsubdir/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &amp;&amp;
- mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD</tt></pre>
+ mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD</code></pre>
</div></div>
</div>
</div>
@@ -1172,8 +1170,8 @@ git filter-branch ... D..H --not C</tt></pre>
<h2 id="_checklist_for_shrinking_a_repository">Checklist for Shrinking a Repository</h2>
<div class="sectionbody">
<div class="paragraph"><p>git-filter-branch can be used to get rid of a subset of files,
-usually with some combination of <tt>--index-filter</tt> and
-<tt>--subdirectory-filter</tt>. People expect the resulting repository to
+usually with some combination of <code>--index-filter</code> and
+<code>--subdirectory-filter</code>. People expect the resulting repository to
be smaller than the original, but you need a few more steps to
actually make it smaller, because Git tries hard not to lose your
objects until you tell it to. First make sure that:</p></div>
@@ -1181,13 +1179,13 @@ objects until you tell it to. First make sure that:</p></div>
<li>
<p>
You really removed all variants of a filename, if a blob was moved
- over its lifetime. <tt>git log --name-only --follow --all -- filename</tt>
+ over its lifetime. <code>git log --name-only --follow --all -- filename</code>
can help you find renames.
</p>
</li>
<li>
<p>
-You really filtered all refs: use <tt>--tag-name-filter cat -- --all</tt>
+You really filtered all refs: use <code>--tag-name-filter cat -- --all</code>
when calling git-filter-branch.
</p>
</li>
@@ -1197,7 +1195,7 @@ to clone, that keeps your original intact.</p></div>
<div class="ulist"><ul>
<li>
<p>
-Clone it with <tt>git clone file:///path/to/repo</tt>. The clone
+Clone it with <code>git clone file:///path/to/repo</code>. The clone
will not have the removed objects. See <a href="git-clone.html">git-clone(1)</a>. (Note
that cloning with a plain path just hardlinks everything!)
</p>
@@ -1210,21 +1208,21 @@ warned.</p></div>
<div class="ulist"><ul>
<li>
<p>
-Remove the original refs backed up by git-filter-branch: say <tt>git
+Remove the original refs backed up by git-filter-branch: say <code>git
for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git
- update-ref -d</tt>.
+ update-ref -d</code>.
</p>
</li>
<li>
<p>
-Expire all reflogs with <tt>git reflog expire --expire=now --all</tt>.
+Expire all reflogs with <code>git reflog expire --expire=now --all</code>.
</p>
</li>
<li>
<p>
-Garbage collect all unreferenced objects with <tt>git gc --prune=now</tt>
+Garbage collect all unreferenced objects with <code>git gc --prune=now</code>
(or if your git-gc is not new enough to support arguments to
- <tt>--prune</tt>, use <tt>git repack -ad; git prune</tt> instead).
+ <code>--prune</code>, use <code>git repack -ad; git prune</code> instead).
</p>
</li>
</ul></div>
@@ -1267,7 +1265,7 @@ By default The BFG takes full advantage of multi-core machines,
The <a href="http://rtyley.github.io/bfg-repo-cleaner/#examples">command options</a>
are much more restrictive than git-filter branch, and dedicated just
to the tasks of removing unwanted data- e.g:
- <tt>--strip-blobs-bigger-than 1M</tt>.
+ <code>--strip-blobs-bigger-than 1M</code>.
</p>
</li>
</ul></div>