DEV Community

Discussion on: How to better organize your git commits

Collapse
 
fwolfst profile image
Felix Wolfsteller

... and if there are a lot of changes in many different files and you want to select only the ones relevant for the current changeset, consider git add --interactive (or git add -i). With that you can select beforehand which files are relevant. Also good if you forgot to stage a hunk that would come really "late" when going through all changes via --patch (you can call git add -p and git add -i as often as you want until you git commit -v).

Collapse
 
krzykamil profile image
Krzysztof

--interactive is also an interesting option that's true, but I decided too skip on it in this article cause it's formula is a bit more complex with it's prompts and I wanted to showcase the more basic way of spliting hunks into commits. But it's good to mention it at least, so thanks :)