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 <yess@hell.org.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tadeusz Andrzej Kadłubowski committed
Feb 21, 2013 at 21:23 UTC
21b6e4f24c74755d700d59edd47d5b88ff56ea5d
1 file changed
+20
Documentation/git-filter-branch.txt
+20
@@ -332,6 +332,26 @@ git filter-branch --msg-filter '
332
' HEAD~10..HEAD
333
--------------------------------------------------------
334
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
+ GIT_AUTHOR_EMAIL=john@example.com
345
+ export GIT_AUTHOR_EMAIL
346
+ fi
347
+ if test "$GIT_COMMITTER_EMAIL" = "root@localhost"
348
+ then
349
+ GIT_COMMITTER_EMAIL=john@example.com
350
+ export GIT_COMMITTER_EMAIL
351
+ fi
352
+' -- --all
353
+--------------------------------------------------------
354
+
355
To restrict rewriting to only part of the history, specify a revision
356
range in addition to the new branch name. The new branch name will
357
point to the top-most revision that a 'git rev-list' of this range