Short tip: Partial Commits with VSCode
One of the most important Git best practices is to write commits as atomic as possible - that is, to submit as few changes as possible, but as many as necessary. The advantage is obvious: commits can be reverted individually using git revert
. If you mix bug fixes and new features wildly in one commit, you will undo more than you originally wanted in case of an error.
It becomes problematic if you have been working on different topics all day and have forgotten to submit your changes in between. Quickly many different changes are collected in one file and at the latest at the evening commit you are faced with a challenge.
Fortunately, only parts of changed files can be added to the stage in VSCode before a commit is triggered. To do this, simply select the file in question in the working tree, then mark the relevant sections in the right-hand field - the corresponding areas can then be added to the stage via the context menu:
The feature is trivial and ingenious at the same time - how could I live without it until now? 🙂