VS Code Tip: commit part of a file

A cool feature of Git is that you can stage/commit some of the modifcations that were made to a file while leaving the other parts unstaged.

This is nice when you’ve made several changes and need to commit one of them to fix something asap.

You can use this Git feature right from VS Code. Select the changes you want commited by clicking the change indicators in the gutter.

selectChange

Stage the change using the + icon.

stageChange

You can then commit it normally. You will see your other unstaged changes for this file under the CHANGES header.

commitChange