{"thread":{"id":"32964","subject":"[PATCH 2/2] Documentation: filter-branch env-filter example","startedAt":"2013-02-21T20:23:38Z","lastAt":"2013-02-21T20:49:10Z","messageCount":2,"participants":["Tadeusz Andrzej Kadłubowski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"209991","messageId":"5126824A.2060903@hell.org.pl","threadId":"32964","inReplyTo":null,"subject":"[PATCH 2/2] Documentation: filter-branch env-filter example","fromName":"Tadeusz Andrzej Kadłubowski","fromEmail":"yess@hell.org.pl","sentAt":"2013-02-21T20:23:38Z","receivedAt":"2013-02-21T20:23:38Z","isPatch":true,"sender":{"key":"yess@hell.org.pl","avatar":"https://avatars.githubusercontent.com/u/207712?v=4"},"body":"filter-branch --env-filter example that shows how to change the email\naddress in all commits before publishing a project.\n\nSigned-off-by: Tadeusz Andrzej Kadłubowski <yess@hell.org.pl>\n---\n Documentation/git-filter-branch.txt | 21 +++++++++++++++++++++\n 1 file changed, 21 insertions(+)\n\ndiff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt\nindex e50ee2f..660bd32 100644\n--- a/Documentation/git-filter-branch.txt\n+++ b/Documentation/git-filter-branch.txt\n@@ -329,6 +329,27 @@ git filter-branch --msg-filter '\n ' HEAD~10..HEAD\n --------------------------------------------------------\n +The `--env-filter` option can be used to modify committer and/or author\n+identity.  For example, if you found out that your commits have the wrong\n+identity due to a misconfigured user.email, you can make a correction,\n+before publishing the project, like this:\n+\n+\n+--------------------------------------------------------\n+git filter-branch --env-filter '\n+\tif test \"$GIT_AUTHOR_EMAIL\" = \"root@localhost\"\n+\tthen\n+\t\tGIT_AUTHOR_EMAIL=john@example.com\n+\t\texport GIT_AUTHOR_EMAIL\n+\tfi\n+\tif test \"$GIT_COMMITTER_EMAIL\" = \"root@localhost\"\n+\tthen\n+\t\tGIT_COMMITTER_EMAIL=john@example.com\n+\t\texport GIT_COMMITTER_EMAIL\n+\tfi\n+' -- --all\n+--------------------------------------------------------\n+\n To restrict rewriting to only part of the history, specify a revision\n range in addition to the new branch name.  The new branch name will\n point to the top-most revision that a 'git rev-list' of this range\n-- \n1.7.11.7\n"},{"id":"209996","messageId":"7vsj4ptmt5.fsf@alter.siamese.dyndns.org","threadId":"32964","inReplyTo":"5126824A.2060903@hell.org.pl","subject":"Re: [PATCH 2/2] Documentation: filter-branch env-filter example","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-21T20:49:10Z","receivedAt":"2013-02-21T20:49:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tadeusz Andrzej Kadłubowski  <yess@hell.org.pl> writes:\n\n> filter-branch --env-filter example that shows how to change the email\n> address in all commits before publishing a project.\n>\n> Signed-off-by: Tadeusz Andrzej Kadłubowski <yess@hell.org.pl>\n> ---\n\nAssuming that the result formats well both as html and manpage, the\nadded example looks good to me.  I somehow suspect that there is a\npatch-mangling going on, though.\n\n>  Documentation/git-filter-branch.txt | 21 +++++++++++++++++++++\n>  1 file changed, 21 insertions(+)\n>\n> diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt\n> index e50ee2f..660bd32 100644\n> --- a/Documentation/git-filter-branch.txt\n> +++ b/Documentation/git-filter-branch.txt\n> @@ -329,6 +329,27 @@ git filter-branch --msg-filter '\n>  ' HEAD~10..HEAD\n>  --------------------------------------------------------\n>  +The `--env-filter` option can be used to modify committer and/or author\n> +identity.  For example, if you found out that your commits have the wrong\n> +identity due to a misconfigured user.email, you can make a correction,\n> +before publishing the project, like this:\n> +\n> +\n> +--------------------------------------------------------\n> +git filter-branch --env-filter '\n> +\tif test \"$GIT_AUTHOR_EMAIL\" = \"root@localhost\"\n> +\tthen\n> +\t\tGIT_AUTHOR_EMAIL=john@example.com\n> +\t\texport GIT_AUTHOR_EMAIL\n> +\tfi\n> +\tif test \"$GIT_COMMITTER_EMAIL\" = \"root@localhost\"\n> +\tthen\n> +\t\tGIT_COMMITTER_EMAIL=john@example.com\n> +\t\texport GIT_COMMITTER_EMAIL\n> +\tfi\n> +' -- --all\n> +--------------------------------------------------------\n> +\n>  To restrict rewriting to only part of the history, specify a revision\n>  range in addition to the new branch name.  The new branch name will\n>  point to the top-most revision that a 'git rev-list' of this range\n"}]}