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?
-a
,--all
Tell the command to automatically stage files that have been modified and deleted, but new files you have not told git about are not affected.
Git has a staging area. By default git commit
only commits data added to that staging area. The -a
switch 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 add
the files you want to commit - or if you want it even more fine-grained, you'd git add -p
and 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
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