You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
# see https://help.github.com/articles/changing-author-info/
NAME=`basename ${BASH_SOURCE[0]}`
DESCRIPTION="Change any commits that previously had the old email address in its author or committer fields to use the correct name and email address."
# Define help function
function help(){
if [[ -z "$1" ]]; then echo "${NAME}: ${DESCRIPTION}"; else echo ${NAME}: $1; fi
# echo "${NAME} - ${DESCRIPTION}";
echo "Usage example: ${NAME} -o value -n value -e value";
echo "Options:";
echo " -o: OLD_EMAIL. Required.";
echo " -n: CORRECT_NAME. Required.";
echo " -e: CORRECT_EMAIL. Required.";
exit 1;
}
while getopts ":o:n:e:h" optname
do
case "$optname" in
"h")
help
;;
"o")
OLD_EMAIL=$OPTARG
;;
"n")
CORRECT_NAME=$OPTARG
;;
"e")
CORRECT_EMAIL=$OPTARG
;;
"?")
help "Invalid option: -$OPTARG"
;;
":")
help "Option -$OPTARG requires an argument."
;;
*)
help "Unknown error while processing options"
;;
esac
done
shift $((OPTIND-1))
# Check required arguments
if [[ -z "$OLD_EMAIL" ]]; then help "Option -o is required"; fi
if [[ -z "$CORRECT_NAME" ]]; then help "Option -n is required"; fi
if [[ -z "$CORRECT_EMAIL" ]]; then help "Option -e is required"; fi