modifying commit's author
If I got the author wrong on a commit, is there a quick way to fix it (e.g. by passing the right arguments or environment variables to commit --amend)?
--b.
måndag 22 januari 2007 21:37 skrev J. Bruce Fields:
Quoted 3 lines
If I got the author wrong on a commit, is there a quick way to fix it (e.g. by passing the right arguments or environment variables to commit --amend)?
Set these:GIT_AUTHOR_EMAILGIT_AUTHOR_NAMEGIT_COMMITTER_EMAILGIT_COMMITTER_NAME
-- robin
Quoted 10 lines · Robin Rosenberg
måndag 22 januari 2007 21:37 skrev J. Bruce Fields:
Quoted 3 lines
If I got the author wrong on a commit, is there a quick way to fix it (e.g. by passing the right arguments or environment variables to commit --amend)?
Set these:
GIT_AUTHOR_EMAILGIT_AUTHOR_NAMEGIT_COMMITTER_EMAILGIT_COMMITTER_NAME
That doesn't seem to work in this case, since with the commands that take an existing commit as a model (like commit --amend and commit -c), the author information from the existing commit overrides those environment variables. Which is normally what you want.
--b.
Quoted 4 lines · J. Bruce Fields
If I got the author wrong on a commit, is there a quick way to fix it (e.g. by passing the right arguments or environment variables to commit --amend)?
Use cogito: cg commit --amend -e
You can edit the author name+email in the commit message.
-- Hannes
Quoted 3 lines · J. Bruce Fields
If I got the author wrong on a commit, is there a quick way to fix it (e.g. by passing the right arguments or environment variables to commit --amend)?
I usually do "format-patch -$n; reset --hard HEAD~$n; edit 00??-*.patch; am 00??-*.patch" myself when I got into that situation to rebuild the branch, and haven't personally felt need for an option to --amend, but it might make sense to teach git-commit --amend to allow --author option to override it; I think it currently ignores --author when given without erroring out.
It may become a question if we would want to allow updating the timestamp as well, but when people asked for --author I did not hear from anybody who wanted to have --authortime, so not being able to do so probably is Ok.
Quoted 6 lines · Junio C Hamano
Quoted 3 lines · J. Bruce Fields
If I got the author wrong on a commit, is there a quick way to fix it (e.g. by passing the right arguments or environment variables to commit --amend)?
Quoted 7 lines
I usually do "format-patch -$n; reset --hard HEAD~$n; edit 00??-*.patch; am 00??-*.patch" myself when I got into that situation to rebuild the branch, and haven't personally felt need for an option to --amend, but it might make sense to teach git-commit --amend to allow --author option to override it; I think it currently ignores --author when given without erroring out.
That might be nice, but actually the git-am trick is more convenient than I'd realized; thanks for the tip.
--b.
Quoted 14 lines · Junio C Hamano
Quoted 3 lines · J. Bruce Fields
If I got the author wrong on a commit, is there a quick way to fix it (e.g. by passing the right arguments or environment variables to commit --amend)?
I usually do "format-patch -$n; reset --hard HEAD~$n; edit 00??-*.patch; am 00??-*.patch" myself when I got into that situation to rebuild the branch, and haven't personally felt need for an option to --amend, but it might make sense to teach git-commit --amend to allow --author option to override it; I think it currently ignores --author when given without erroring out.
Quoted 4 lines
It may become a question if we would want to allow updating the timestamp as well, but when people asked for --author I did not hear from anybody who wanted to have --authortime, so not being able to do so probably is Ok.
Untested, but something along this line.
-- >8 --
[PATCH] honor --author even with --amend, -C, and -c.
Earlier code discarded GIT_AUTHOR_DATE taken from the base commit when --author was specified. This was often wrong as that use is likely to fix the spelling of author's name.
---
git-commit.sh +10 -9
@@ -462,15 +462,7 @@ if test -f "$GIT_DIR/MERGE_HEAD" && test -z "$no_edit"; then fi >>"$GIT_DIR"/COMMIT_EDITMSG # Author -if test '' != "$force_author" -then - GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` && - GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` && - test '' != "$GIT_AUTHOR_NAME" && - test '' != "$GIT_AUTHOR_EMAIL" || - die "malformed --author parameter" - export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL -elif test '' != "$use_commit" +if test '' != "$use_commit" then pick_author_script=' /^author /{
@@ -501,6 +493,15 @@ then export GIT_AUTHOR_EMAIL export GIT_AUTHOR_DATE fi +if test '' != "$force_author" +then + GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` && + GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` && + test '' != "$GIT_AUTHOR_NAME" && + test '' != "$GIT_AUTHOR_EMAIL" || + die "malformed --author parameter" + export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL +fi PARENTS="-p HEAD" if test -z "$initial_commit"