git modifies a submitted email and user information
伊谢尔伦
伊谢尔伦 2017-05-02 09:41:02
0
1
695

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.

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
黄舟

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 submissionmore tests for later change cases.

The first step is to copy the fourth submissionupdate readmeSHA1 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 -ioperation, as follows:

git rebase -i 4535579

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) pickedit 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:

git commit --amend --author="LiLei <lilei@qq.com>" --no-edit

Continue to finishrebase,

git rebase --continue

Open gitk again and enjoy your results:

Finally, synchronize the result of tampering with the history record to the server through git push --force

Note that forced updates have certain risks. If someone else is submitting code to the server at this time, it will be overwritten by your forced updates.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template