Case 1: Last submission and no push Execute the following command: git commit --amend git will open the $EDITOR editor, which will load the log of this submission so that we can edit it. After editing, save it to complete the modification. Case 2: Last submission and pushed to the server Execute the following command:
Same as situation one. When using push to push to a remote server, you need to add --force to let the server update the history. It should be noted that forcing the modified log to be pushed to the Git server may cause other people's local copies to be out of sync if they have modified them, so it is best to check with them. Case 3: Old commits and not pushed Assuming that the commit is the third to last commit, this can be viewed using git log.
Add content
Add contentc
Add content
Execute rebase git rebase -i HEAD~3 It will open an editor that will show the last 3 commits, similar to this:
You'll see that it's displayed in the order of the commits, which is the reverse order that git log shows. Locate the line where you want to edit the log, change pick to edit, and save. Next is to modify the log content git commit --amend When you are done editing the log, remember to execute: git rebase --continue The purpose of rebase is to open up the history of commits and let you choose what to modify. Git will let you modify the content in a new branch. git rebase --continue allows you to return to the previous branch. Case 4: Old submission and has been pushed to the server The previous operation of editing the log is the same as in case 3:
X indicates the last submission. After you finish editing the log, execute push: git push origin master --force The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Datagrip2020 fails to download MySQL driver
>>: Why is it not recommended to use an empty string as a className in Vue?
How PHP works First, let's understand the rel...
When using apt-get to install, it will be very sl...
Table of contents Features Preservation strategy ...
Table of contents 1. Prepare the springboot proje...
When using the docker-maven-plugin plug-in, Maven...
Table of contents 1 The role of Apache 2 Apache I...
background: Because the server deployed the flask...
Table of contents 3 ways to deploy projects with ...
Table of contents 1. Introduction 2. filter() 3. ...
Use CSS to create a 3D photo wall. The specific c...
In the previous article, we used Docker to build ...
1. Style object The style object represents a sin...
Table of contents Problem Description 1. Basic so...
First find out where the configuration file is wh...
IDEA is the most commonly used development tool f...