Skip to content

Commit 21b6e4f

Browse files
tkadlubogitster
authored andcommitted
Documentation: filter-branch env-filter example
filter-branch --env-filter example that shows how to change the email address in all commits before publishing a project. Signed-off-by: Tadeusz Andrzej Kadłubowski <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bee3eb0 commit 21b6e4f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Documentation/git-filter-branch.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,26 @@ git filter-branch --msg-filter '
332332
' HEAD~10..HEAD
333333
--------------------------------------------------------
334334

335+
The `--env-filter` option can be used to modify committer and/or author
336+
identity. For example, if you found out that your commits have the wrong
337+
identity due to a misconfigured user.email, you can make a correction,
338+
before publishing the project, like this:
339+
340+
--------------------------------------------------------
341+
git filter-branch --env-filter '
342+
if test "$GIT_AUTHOR_EMAIL" = "root@localhost"
343+
then
344+
345+
export GIT_AUTHOR_EMAIL
346+
fi
347+
if test "$GIT_COMMITTER_EMAIL" = "root@localhost"
348+
then
349+
350+
export GIT_COMMITTER_EMAIL
351+
fi
352+
' -- --all
353+
--------------------------------------------------------
354+
335355
To restrict rewriting to only part of the history, specify a revision
336356
range in addition to the new branch name. The new branch name will
337357
point to the top-most revision that a 'git rev-list' of this range

0 commit comments

Comments
 (0)