When using Git, my workflow usually involves firing up TortoiseGit and selecting the files that i'd like to commit.
This (i assume) runs git add (?) and commits these changes to the local repo.
My question is -- why is the separation between ADDING files to the index and COMMITTING them needed?
Are there any use cases for simply adding files to the index without committing them at the same moment?
Adding files to the index is called staging. Staging provides a separation between what is to be committed and what is to remain outside the commit. If you made some changes that are better suited for a different commit, you can just leave them there without staging and make a commit for things that were added to the index.
So, in essence, it helps you prepare simple, coherent commits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With