Say you had configured your email with a typo (say, as [email protected], instead of [email protected]), and want to now fix the email in the git logs, you can do this:
Remember that it is ok to do this if you have not yet shared your commits to the external world. However, if you have already shared it, it might not be appropriate to do this, since the filter-branch command creates new commit objects (with different SHA ids than the original commits).
Read more about the git filter-branch command at http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html.
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "[email protected]" ];
then
export [email protected];
git commit-tree "$@";
else
shift;
while [ -n "$1" ];
do
shift;
map "$1";
shift;
done;
fi'
if [ "$GIT_AUTHOR_EMAIL" = "[email protected]" ];
then
export [email protected];
git commit-tree "$@";
else
shift;
while [ -n "$1" ];
do
shift;
map "$1";
shift;
done;
fi'
Remember that it is ok to do this if you have not yet shared your commits to the external world. However, if you have already shared it, it might not be appropriate to do this, since the filter-branch command creates new commit objects (with different SHA ids than the original commits).
Read more about the git filter-branch command at http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html.
No comments :
Post a Comment