Last active
January 1, 2020 02:00
-
-
Save aryelgois/ef18d6fa7ac7768f5b8d93e6b0a2e27f to your computer and use it in GitHub Desktop.
Amend the last commit overriding the committer and author info
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
#!/bin/sh | |
# Amend the last commit overriding the committer and author info. | |
# | |
# The committer info is forced to be the same as the author's. | |
# | |
# Options: | |
# $1 Overrides date | |
# $2 Overrides name | |
# $3 Overrides email | |
# | |
# You can pass an empty argument to skip it and change the next one. | |
D=${1:-$(git log --format='%ad' -1)} | |
N=${2:-$(git log --format='%an' -1)} | |
E=${3:-$(git log --format='%ae' -1)} | |
GIT_COMMITTER_DATE=$D \ | |
GIT_COMMITTER_NAME=$N \ | |
GIT_COMMITTER_EMAIL=$E \ | |
git commit --amend --date="$D" --author="$N <$E>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment