It is caused by the difference between the git company username and my own
When submitting code, the global git user configuration is used by default, user name xiaoli
and then pushed to github
After that, I configured the git user of the project and used xiaowang
to push the code again
What should I do if I want to rewrite the user email address of the first git commit?
I use
git rebase -i HEAD~2
But only the last submission information appears.
My steps are a bit cumbersome, so I prepared pictures for annotation:
First, open the history record through
gitk
, as shown below:In this example, I am trying to modify the username/email information corresponding to the third submission
more tests for later change cases
.The first step is to copy the fourth submission
update readme
的SHA1 ID
值,如上图选中部分4535579
(not all necessary, the first eight in my impression are enough)The second step is to return to the command line and start executing the
rebase -i
operation, as follows:At this time,
git
will automatically call the configured editor to open an interface, as follows:The third step is to modify the first row of data (the commit we expect to modify)
pick
为edit
as follows:Save and exit, you can see the following results:
Shuai, now we can easily modify user information through
git commit --amend
. The operation is as follows:Continue to finish
rebase
,Open
gitk
again and enjoy your results:Finally, synchronize the result of tampering with the history record to the server through
git push --force