git rebase - what's the difference between 'edit' and 'reword'

GitGit RebaseGit Rewrite-History

Git Problem Overview


What's the difference between edit and reword when you do a git rebase?

I'm going through some docs which say this:

Replace pick with:
- edit to mark a commit for amending.
- reword to change the log message.

Git Solutions


Solution 1 - Git

  • "reword" allows you to change ONLY the commit message, NOT the commit contents
  • "edit" allows you to change BOTH commit contents AND commit message (the mechanism by which git allows you to edit the commit contents is by "pausing" the rebase; so you can amend the commit)

reference : The git-rebase documentation says this:

  • edit : By replacing the command "pick" with the command "edit", you can tell git rebase to stop after applying that commit, so that you can edit the files and/or the commit message, amend the commit, and continue rebasing.
  • reword : If you just want to edit the commit message for a commit, replace the command "pick" with the command "reword".

Solution 2 - Git

edit will pause the rebase entirely, allowing you to change files in the commit and/or the commit message.

reword will simply open an editor to let you change the commit message only.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSnowcrashView Question on Stackoverflow
Solution 1 - GitChris MaesView Answer on Stackoverflow
Solution 2 - GitSLaksView Answer on Stackoverflow