2

When i raised a PR(pull request) in GitHub , i had wrong email-id i.e abc@xyz.com.

$ git log
commit 4f65741b4b414bdf7e287c7bbd28d5e727ff62b9 (HEAD -> perf-enh-tcs)
Author: abc<abc@xyz.com>
Date:   Mon Aug 24 15:53:43 2020 +0530

The email-id in GitHub is abc@xyz.tech. So due to mismatch, there is error in PR.

I tried fixing the email-id on my laptop git account to abc@xyz.tech using below command git config --global user.email "abc@xyz.tech"

When i pushed the new patch set , i still see old email taken and PR failing.

  • 4
    Is it only 1 commit, and it's the latest in your branch? Are you okay with having to force push it? Is anyone else depending on that branch? If it's the latest commit and the only one that needs fixing, make sure you have no staged changes and you can use `git commit --amend --reset-author` to fix the author. If there's more than that, then you should look at https://stackoverflow.com/questions/750172/how-to-change-the-author-and-committer-name-and-e-mail-of-multiple-commits-in-gi. – John Szakmeister Aug 24 '20 at 18:03
  • 1
    With "git commit --amend --reset-author" , i was able to get rid of old email. When i pushed the new patchset , it correctly took the new email id and PR passed. – Hanamantagoud Aug 26 '20 at 14:01

1 Answers1

0

Run the following command to amend (change) the author of the latest commit:

git commit --amend --author="Full Name <email@xxx.y>" --no-edit
  • What the command does is overwriting the most recent commit with the new one.
  • The --no-edit flag allows you to modify your commit without changing its message.
Ousama
  • 2,176
  • 3
  • 21
  • 26