I’m trying to wrap my head around the intricacies of Git.
I pulled down a repository from GitHub using “git clone [url here]”.
I made some changes, the tried to commit them with “git commit”. This didn’t seem to push the changes into my local repository (in local dir “.git), and it recommended that I use “git commit -a” instead.
I’m wondering why do I have to append “-a” to the “git commit”, and whats the difference between “stage” and “commit” in git?
Git has a staging area. By default
git commitonly commits data added to that staging area. The-aswitch commits all uncommitted changing from the working copy itself.The idea of the staging area is that you might not want to commit all changes at once. If that’s the case you’d
git addthe files you want to commit – or if you want it even more fine-grained, you’dgit add -pand select only some changes within a file to be commited.There’s a nice explanation plus an image showing how it basically works in the GitHub Git tutorial: http://web.archive.org/web/20130519130755/http://learn.github.com/p/normal.html