Commit Chunks in Magit

A few days back I found a nice little feature in the Emacs Magit Mode.

If you work on one of your versioned files you might end up with something like this:

Chunks in th Magit Status View

There are changes in different places in the file but to create a cleaner commit you just want to commit some of them.

To do so one could use git commit -p. As many posts state this is a pretty complicated command so you probably don’t want to do that if not really necessary.

Magit to the rescue!

Just select the stuff you want to stage in the Magit diff and press s like you would do in the normal stage process. That’s all. Easy, right?

Here is a look after a chunk is staged.

Staged chunk in th Magit Status View

comments powered by Disqus