Skip to content

Commit b575b25

Browse files
authored
Merge pull request github#15962 from github/repo-sync
repo sync
2 parents 705869f + 0e63afc commit b575b25

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

content/github/committing-changes-to-your-project/changing-a-commit-message.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ versions:
1313

1414
You can change the most recent commit message using the `git commit --amend` command.
1515

16-
{% warning %}
17-
1816
In Git, the text of the commit message is part of the commit. Changing the commit message will change the commit ID--i.e., the SHA1 checksum that names the commit. Effectively, you are creating a new commit that replaces the old one.
1917

20-
{% endwarning %}
21-
22-
#### Commit has not been pushed online
18+
### Commit has not been pushed online
2319

2420
If the commit only exists in your local repository and has not been pushed to {% data variables.product.product_location %}, you can amend the commit message with the `git commit --amend` command.
2521

@@ -39,7 +35,7 @@ You can change the default text editor for Git by changing the `core.editor` set
3935

4036
{% endtip %}
4137

42-
#### Amending older or multiple commit messages
38+
### Amending older or multiple commit messages
4339

4440
If you have already pushed the commit to {% data variables.product.product_location %}, you will have to force push a commit with an amended message.
4541

@@ -49,15 +45,15 @@ We strongly discourage force pushing, since this changes the history of your rep
4945

5046
{% endwarning %}
5147

52-
**Amending the message of the most recently pushed commit**
48+
**Changing the message of the most recently pushed commit**
5349

5450
1. Follow the [steps above](/articles/changing-a-commit-message#commit-has-not-been-pushed-online) to amend the commit message.
5551
2. Use the `push --force` command to force push over the old commit.
5652
```shell
5753
$ git push --force <em>example-branch</em>
5854
```
5955

60-
**Amending the message of older or multiple commit messages**
56+
**Changing the message of older or multiple commit messages**
6157

6258
If you need to amend the message for multiple commits or an older commit, you can use interactive rebase, then force push to change the commit history.
6359

@@ -93,7 +89,6 @@ If you need to amend the message for multiple commits or an older commit, you ca
9389
#
9490
# Note that empty commits are commented out
9591
```
96-
9792
3. Replace `pick` with `reword` before each commit message you want to change.
9893
```shell
9994
pick e499d89 Delete CNAME
@@ -102,10 +97,10 @@ If you need to amend the message for multiple commits or an older commit, you ca
10297
```
10398
4. Save and close the commit list file.
10499
5. In each resulting commit file, type the new commit message, save the file, and close it.
105-
6. Force-push the amended commits.
106-
```shell
107-
$ git push --force
108-
```
100+
6. When you're ready to push your changes to GitHub, use the push --force command to force push over the old commit.
101+
```shell
102+
$ git push --force <em>example-branch</em>
103+
```
109104
110105
For more information on interactive rebase, see "[Interactive mode](https://git-scm.com/docs/git-rebase#_interactive_mode)" in the Git manual.
111106

0 commit comments

Comments
 (0)