@matheusbsbs / matheus-bagliano / commits / 32c37c1237
Fork 0

filter-branch documentation: some more touch-ups.

- The map function used to fail, but no longer does (since 3520e1e8687.) - Fix the "edge-graft" example. - Show the same using .git/info/grafts. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Sixt committed Jul 4, 2007 at 09:32 UTC 32c37c123741bee79617a6830257519c53681704
1 file changed +16 -7
Documentation/git-filter-branch.txt
+16 -7
@@ -58,8 +58,9 @@ and GIT_COMMITTER_DATE are set according to the current commit.
58
59 A 'map' function is available that takes an "original sha1 id" argument
60 and outputs a "rewritten sha1 id" if the commit has been already
61 -rewritten, fails otherwise; the 'map' function can return several
62 -ids on separate lines if your commit filter emitted multiple commits.
61 +rewritten, and "original sha1 id" otherwise; the 'map' function can
62 +return several ids on separate lines if your commit filter emitted
63 +multiple commits.
64
65
66 OPTIONS
@@ -166,12 +167,13 @@ git filter-branch --index-filter 'git update-index --remove filename' newbranch
167 Now, you will get the rewritten history saved in the branch 'newbranch'
168 (your current branch is left untouched).
169
169 -To "etch-graft" a commit to the revision history (set a commit to be
170 -the parent of the current initial commit and propagate that):
170 +To set a commit (which typically is at the tip of another
171 +history) to be the parent of the current initial commit, in
172 +order to paste the other history behind the current history:
173
172 -----------------------------------------------------------------------
173 -git filter-branch --parent-filter sed\ 's/^$/-p <graft-id>/' newbranch
174 -----------------------------------------------------------------------
174 +------------------------------------------------------------------------
175 +git filter-branch --parent-filter 'sed "s/^\$/-p <graft-id>/"' newbranch
176 +------------------------------------------------------------------------
177
178 (if the parent string is empty - therefore we are dealing with the
179 initial commit - add graftcommit as a parent). Note that this assumes
@@ -183,6 +185,13 @@ git filter-branch --parent-filter \
185 'cat; test $GIT_COMMIT = <commit-id> && echo "-p <graft-id>"' newbranch
186 -------------------------------------------------------------------------------
187
188 +or even simpler:
189 +
190 +-----------------------------------------------
191 +echo "$commit-id $graft-id" >> .git/info/grafts
192 +git filter-branch newbranch $graft-id..
193 +-----------------------------------------------
194 +
195 To remove commits authored by "Darl McBribe" from the history:
196
197 ------------------------------------------------------------------------------