Created
September 11, 2012 18:09
-
-
Save kgodard/3700416 to your computer and use it in GitHub Desktop.
fix author on last several commits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the case where just the top few commits have bad authors, you can do this all inside git rebase -i using the exec command and the --amend commit, as follows: | |
git rebase -i HEAD^^^^^^ # as required | |
which presents you with the editable list of commits: | |
pick abcd Someone else's commit | |
pick defg my bad commit 1 | |
pick 1234 my bad commit 2 | |
Then add exec ... --author="..." lines after all lines with bad authors: | |
pick abcd Someone else's commit | |
pick defg my bad commit 1 | |
exec git commit --amend --author="New Author Name <email@address.com>" -C HEAD | |
pick 1234 my bad commit 2 | |
exec git commit --amend --author="New Author Name <email@address.com>" -C HEAD | |
save and run. | |
This solution may be longer to type than some others, but it's highly controllable - I know exactly what commits it hits. | |
Thanks to @asmeurer for the inspiration. | |
[credit to Alex Brown on StackOverflow] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment