Skip to content

Instantly share code, notes, and snippets.

@jaymecd
Created December 3, 2018 22:45
Show Gist options
  • Save jaymecd/9498acfec684fc7768eca6515577598b to your computer and use it in GitHub Desktop.
Save jaymecd/9498acfec684fc7768eca6515577598b to your computer and use it in GitHub Desktop.
Amend GIT author within branch starting from COMMIT_ID

To reset commit author its required:

  1. to update default user name/email. (--global could added)
$ git config user.name example user
$ git config user.email example@email.com
  1. set checkpoint to keep orignal commit tree.
$ git branch --no-track checkpoint master
  1. to run fixer command, what would update author, while creating new commit tree.
$ COMMIT_ID="<COMMIT_ID>"
$ git rebase --onto "${COMMIT_ID}" --exec "git commit --amend --reset-author --no-edit" "${COMMIT_ID}"
  1. review that all good and update remote, plus drop checkoiunt:
$ git push origin master -f
$ git branch -D checkpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment