Working under a one-commit-per-pull-request rule surfaces the need to master a few key Git commands. This covers four tools for managing commit history: `git commit --amend` for fixing the most recent commit, `git reset --soft` for collapsing multiple commits into one while preserving all changes, `git rebase -i` for surgical history editing including reordering and selective squashing, and GitHub's squash-and-merge button as a UI alternative. A decision table maps common situations to the right tool, and the post notes important cautions around force-pushing when rewriting already-pushed history.

5m read timeFrom spin.atomicobject.com
Post cover image
Table of contents
git commit : The Foundationgit commit –amend : Fix the Last Commitgit reset –soft : Undo Commits, Keep Your Workgit rebase -i : Surgical Commit History EditingWhich Should You Use?
1 Comment

Sort: