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?
1. Use of Iframe tag <br />When it comes to ...
Table of contents Interpolation Expressions metho...
Ubuntu install jdk: [link] Install Eclipse on Ubu...
Preface: Docker is an open source application con...
question After the company migrated the server, t...
Introduction: Sometimes, in order to develop a pr...
About CSS3 variables When declaring a variable, a...
I received a task from the company today, and the...
I use Navicat as my database tool. Others are sim...
What is wxs? wxs (WeiXin Script) is a scripting l...
Preface When docker run creates and runs a contai...
Use stored procedures to start transactions when ...
MySQL reports an error when executing multi-table...
Table of contents 1. Introduction 2. JDBC impleme...
This article mainly introduces the implementation...