Skip to content
0:00 / 0:00

#git#gitrebase#gitcommitamend

Rewriting Commit Messages in Git

phette23

103 subscribers • 1 video on Hallway

YouTube
  • Recommended by 1 person: 1 on Stack Overflow and its sister sites.

Beginner. No background in the topic needed.

65K views12 years ago1 recommendation

Tools and practiceGit and version control

A quick tutorial demonstrating how to rewrite Git commit messages using git commit --amend and interactive rebase.

Two quick ways to rewrite a previous commit's message in git: - use `git commit --amend` to redo the last commit's message - use `get rebase -i HEAD~N` to look over & reword the last N commits Useful links: stackoverflow.com/questions/179123/how-do-i-edit-an-incorrec… git-scm.com/book/en/Git-Tools-Rewriting-History git-scm.com/docs/git-rebase intro change last commit with `git amend` go further back with `git rebase`

Why it's here

1 person recommends this

What people say. Recommended as a clear explanation of how to use git rebase to edit older commit messages.

Samuelon Stack Overflow • Recommends

On “How do I edit an incorrect commit message with TortoiseGit?”

For the case of when the commit is in the middle, I highly recommend not following the instructions provided by linquize, see the comments below his answer for the reason. You can use the git command line with TortoiseGit and it won't cause any problems: Can I use command-line Git tools and TortoiseGit simultaneously?. This youtube video explains it really well: link to this video. Basically use git rebase -i and then simply "reword" the commit message. Update: I believe you can retrieve the lost commits from the hard reset suggested by linquize, see Wayne's answer here: How can I reorder/combine commits using Git rebase?.