git reset --merge HEAD~1

Category: Git - Advanced

git reset --merge HEAD~1

Reset without losing overlapping changes

Resets to the given commit but refuses if the working tree has changes that overlap with the difference. It can also cancel an in-progress merge cleanly. When it fails, stash or commit before resetting.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.