File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 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." 
                                 You can’t perform that action at this time. 
               
                  
0 commit comments