AI Hints
Home›Git & GitHub Tutorial›Rewriting and Picking
Git & GitHub · Lesson 90 of 144

More Rebase Commands

Reword, drop and reorder.

⏱ 2 min read▶ Video at 1:38:33🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

Squash is just one option in that to do list. There are a few more, and they're all just as simple.

More Rebase Commands
From the video: More Rebase Commands
  • The todo list has more commands
  • Reword, drop, fixup
  • Reorder lines too

Todo list commands

Pick keeps a commit as it is. Reword keeps it, but lets you change the message. Squash combines it with the one above, and lets you edit the combined message. Fixup combines it too, but silently throws away its message. And drop deletes the commit completely. You can also move lines up or down, to reorder commits.

CommandWhat it does
pickkeep the commit
rewordkeep it, change the message
squashcombine, edit the message
fixupcombine, discard its message
dropdelete the commit

Stay safe

Interactive rebase rewrites history, so the golden rule applies. Only use it on commits you haven't pushed, or on your own branch that nobody else uses. And if anything goes wrong, git rebase dash dash abort, or the reflog, will save you.

Rewrites historynew hashes
Only unsharedyour own commits
Stuck?git rebase --abort
Lost?git reflog

Summary

Pick, reword, squash, fixup and drop let you polish commits before sharing. Next, copying a single commit from one branch to another.

Key takeaways
  • reword: new message
  • fixup: silent squash
  • drop: delete
Next up: Cherry-Pick — copy one commit