Skip to content

Commit 9dc508e

Browse files
Merge pull request #10 from CodeMaster7000/CodeMaster7000-patch-1
Create Git-change-author.sh
2 parents 07af6a7 + 2b476b1 commit 9dc508e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Git-change-author.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!
2+
if [[ -z "$1" || "$1" == "--help" || -z "$2" ]]; then
3+
echo ' Usage: git-change-author "Your Name" "email@address" [SHA1]'
4+
exit 1
5+
fi
6+
AUTHOR="$1"
7+
EMAIL="$2"
8+
START_HASH="${3:---root}"
9+
echo "On the next screen, you need to change 'pick' to 'edit' for every commit which you wish to alter."
10+
echo ""
11+
echo -n "Press ENTER to continue."
12+
read
13+
git rebase --rebase-merges -i ${START_HASH}
14+
while [ "$?" -eq 0 ]; do
15+
git -c user.name="${AUTHOR}" -c user.email="${EMAIL}" commit --amend --no-edit --author "${AUTHOR} <${EMAIL}>"
16+
git rebase --continue
17+
done
18+
git rebase --rebase-merges --committer-date-is-author-date "${START_HASH}"
19+
echo ""
20+
echo ""
21+
echo "Don't forget to run \`git push -f\` - preferably on a test branch first."

0 commit comments

Comments
 (0)