0

I'm trying to push some changes, but my company's bitbucket server is stopping me (rightfully so!) to commit with the wrong committer email. git push fails with five entries like the one I put bellow:

remote: Push rejected.
remote:
remote: refs/heads/feature/<branch>: efc45b4345f500b0175624d97a3cad96d9268e61: expected committer email '<company@email>' but found '<some@value>'

How can I change the committer email for the commits I need to push?

gtludwig
  • 5,411
  • 10
  • 64
  • 90
  • 2
    Possible duplicate of [Git, rewrite previous commit usernames and emails](https://stackoverflow.com/questions/2919878/git-rewrite-previous-commit-usernames-and-emails) – ElpieKay Mar 29 '19 at 11:55
  • I had seen that one, but couldn't get it working. – gtludwig Mar 29 '19 at 12:07
  • 1
    What about this one: https://stackoverflow.com/questions/750172/how-to-change-the-author-and-committer-name-and-e-mail-of-multiple-commits-in-gi ? – padawin Mar 29 '19 at 13:15
  • 1
    Possible duplicate of [How to change the author and committer name and e-mail of multiple commits in Git?](https://stackoverflow.com/questions/750172/how-to-change-the-author-and-committer-name-and-e-mail-of-multiple-commits-in-gi) – phd Mar 29 '19 at 14:54

1 Answers1

0
git commit --amend --author="Author Name <email@address.com>"
riverfall
  • 820
  • 7
  • 23
  • This seems to work for the last commit, but can I cherry pick an older one and do the same? – gtludwig Mar 29 '19 at 12:00
  • 1
    You can do an interactive rebase and modify the desired commit in the described way. See [Rewriting History](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History). – kowsky Mar 29 '19 at 12:05
  • you can also rewrite the author of last 10 commits using ```git change-commits GIT_AUTHOR_EMAIL "old@email.com" "new@email.com" HEAD~10..HEAD``` – riverfall Mar 29 '19 at 13:20