How to amend several commits in Git to change author

前端 未结 6 1020
逝去的感伤
逝去的感伤 2020-11-28 17:14

I have made a series of commits in Git and I realise now that I forgot to set my user name and user email properties correctly (new machine). I have not yet pushed these co

6条回答
  •  南笙
    南笙 (楼主)
    2020-11-28 17:54

    If you're feeling unsafe about debasing and amending you could do it this way. At the same time you'd also be setting the global config which you probably meant to do anyway.

    git reset HEAD~ (undo last commit)

    git config --global user.name "Your Name"

    git config --global user.email you@example.com

    git commit -m "message"

提交回复
热议问题