git filter-branch --env-filter ‘ if test "$GIT_AUTHOR_EMAIL" = "root@localhost" then GIT_AUTHOR_EMAIL=john@example.com fi if test "$GIT_COMMITTER_EMAIL" = "root@localhost" then GIT_COMMITTER_EMAIL=john@example.com fi ‘ -- --all
标签:new env one targe wro cti range its git
https://github.com/git-for-windows/git/issues/2206
https://git-scm.com/docs/git-filter-branch
The --env-filter
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:
git filter-branch --env-filter ‘ if test "$GIT_AUTHOR_EMAIL" = "root@localhost" then GIT_AUTHOR_EMAIL=john@example.com fi if test "$GIT_COMMITTER_EMAIL" = "root@localhost" then GIT_COMMITTER_EMAIL=john@example.com fi ‘ -- --all
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 point to the top-most revision that a git rev-list of this range will print.
Consider this history:
D--E--F--G--H / / A--B-----C
To rewrite only commits D,E,F,G,H, but leave A, B and C alone, use:
git filter-branch ... C..H
To rewrite commits E,F,G,H, use one of these:
git filter-branch ... C..H --not D git filter-branch ... D..H --not C
标签:new env one targe wro cti range its git
原文地址:https://www.cnblogs.com/chucklu/p/10942117.html