Why is there the staging area between \"git add\" and \"git commit\"? I understand the concept, but fail to see the sense in adding files to the staging area before actually
The truth is: the index is a staging area. Every SCM has it, but git shows it to you, and uses it effectively.
One main reason is so you don't have to commit your entire working directory. You can move portions of it to the index and commit just those.
For example, you're working on two different things, and now your code looks like
//random code
//bug fix
//new feature
You can stage just the //bug fix
line and commit that, and than stage the //new feature
line and commit that.
You now have two different commits for each. Later on in testing you realize the new feature
commit broke something, you can delete the new feature
commit, but don't have to recommit the bugfix
As Dickon Reed noted in his answer, you also gain performance as git commit
now only needs to add what is in the index to the commit. It doesn't need to search through your tree to find all the changes.