If you want to change your email address, you will need to change your email address.
This requirement often takes half a day for beginners to understand the modification process, which is too silly, so HERE I make a detailed document to help myself and you understand the process. In particular, understand base change, which is not a single command executed, but a series of commands.
rebase
git rebase -i
Copy the code
When executed, the last commit record is opened. Of course, the command above can specify a record. The command is:
git rebase -i "your commit id"
Copy the code
For sourcetree users, the commit ID is SHA-1. You can right-click a commit record and select the menu “Copy SHA-1 to clipboard”, as shown below:
After the rebase command is executed, information similar to the following is displayed:
Pick BD81DF5 update API
#Rebase abcb9d0.. bd81df5 onto abcb9d0 (1command)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
Copy the code
In the rebase process, you need to change pick to Edit, as follows:
Edit Bd81DF5 updates the API
#Rebase abcb9d0.. bd81df5 onto abcb9d0 (1command)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
Copy the code
After the modification is complete, save the configuration and exit the: :wq editor
It then prints a message like this:
chengmingdeMacBook-Pro:server cmlanche$ git rebase -i "abcb9d0d1e99cdad25d8d08119e494436b000e59" Stopped at bd81df5... You can amend the commit now, with git commit --amend Once You are satisfied with your changes, run git rebase --continue chengmingdeMacBook-Pro:server cmlanche$Copy the code
Amend is an amend, so strange to me, why not change or fix.
The above information says that if you want an amend, you can amend the submission
git commit --amend
Copy the code
If you are satisfied with the change, end the change with the following command
git rebase --continue
Copy the code
Reset account email information
To reset the submitted account information, run the following command:
git commit --amend --author="cmlanche <[email protected]>" --no-edit
Copy the code
Colleagues, watch out for your sourcetree, something new has happened!
We can see a new commit and the email accounts have been modified. If you remove “no-edit” you can also modify the Commit Message (” update API” in the picture). For example, I can continue to modify the base change with “Amend”
git commit --amend --author="cmlanche <[email protected]>"
Copy the code
Save and exit the vi editor to see how sourcetree looks:
It’s perfect. And then we merge, we quit and we rebase.
Exit the rebase
git rebase --continue
Copy the code
Print the command above in the console to exit the base, we see that exit the base is using the latest changes, just a branch.
chengmingdeMacBook-Pro:server cmlanche$ git rebase --continue
Successfully rebased and updated refs/heads/bulma.
Copy the code
So just to conclude
Rebasing is really useful, it’s not a command to do it, it’s a process, like turning on an input stream in rebasing, and then closing the input stream when you’re done.
You can easily modify any information submitted by rebasing!