0

I have a commit with wrong email address in .gitconfig file. I would like to update the email and commit details without reseting the HEAD to older commit hash. Is that possible with git?

  • 2
    Not possible. The commit sha1 is a hash of the whole commit, including the email and commit details. – joanis Feb 19 '19 at 22:22

2 Answers2

1

If you want to change the latest commit use:

git commit --amend --author="John Doe <john@doe.org>"

But before use:

git config --global user.name
git config --global user.email
Adam Bellaïche
  • 427
  • 3
  • 16
0
  • start an interactive rebase:

    git rebase HEAD^ -i
    
  • then in the file opened change the word pick in the first line to reword and close the file.

  • git will open another editor where you can change the autor
Timothy Truckle
  • 15,071
  • 2
  • 27
  • 51