Modifying a commit message via Git rebase

Source: Internet
Author: User

The words in git commit message that found a project today are misspelled and need to be modified. However, this simple modification requires git rebase to complete.

First, Git rebase to the first 1 commits that need to modify the message. Assuming the commit ID is 32e0a87f, run the following git rebase command:

Git rebase-i 32e0a87f

After running the above command in Git bash, the edit box will pop up, and in the edit box, all the commit message after this commit that starts with pick will be displayed in turn.

Change the "pick" to "reword" before the commit message you want to modify, click the Save button and close the edit box, and the Rebase action will be performed.

Rebasing (1/3)

Then the edit box will pop up again, this time the edit box only changed to "reword" the commit message, at this time to modify the contents of the commit message, click the Save button and close the edit box, will continue to perform the rebase operation.

If the operation succeeds, the following prompt appears:

[Detached HEAD aa3b52c] ADD return URL 2 files changed, 1 insertion (+), 3 deletions (-) successfully rebased and updated Refs/heads/oss.

This completes the modification of the GIT commit message and then forces the push to take care of it.

git push--force

Resources

Changing a COMMIT message

Modifying a commit message via Git rebase

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.