Discarding Git Commits

Guangwang Huang (Whatacold) has an instructive video on how to discard commits using Magit. There are three methods:

  1. Hard reset
  2. Revert
  3. Soft reset

They all have advantages and disadvantages. A hard reset is fast but the discarded commits are deleted. The other two methods are safer but involve more typing. You can get all the details by watching the video.

Using either reset can seem like a scary proposition but Whatacold shows that they are both straightforward and easy to understand. If they still seem too fraught, you can always use revert. It generates more commits but doesn’t seem as scary.

The video is 9 minutes, 25 seconds so it should be pretty easy to fit in.

This entry was posted in General and tagged , . Bookmark the permalink.