A practical guide to undoing and rewriting Git history using git reset (--soft, --mixed, --hard), git revert, git cherry-pick, and git reflog. Covers six real-life scenarios including accidentally committing to the wrong branch, splitting a commit into two, recovering from a hard reset, and safely undoing pushed commits. Emphasizes the importance of diagramming current vs. desired state before taking action.

22m read timeFrom towardsdatascience.com
Post cover image
Table of contents
Notes before we startRecording changes in GitUndoing the changesReal-life scenarios!Learn more about GitAbout the author

Sort: