git add -A will stages all changes
git add . will stages new files and modifications, without deletions
git add -u stages modifications and deletions, without new files
Wait, this post is in English. So keep going!
I never put enough thought into the mentor I had. He was not the teacher, he was a guide in this world of web development, just pointing my focus and attention to learning the right thing. And I remember when he told me to avoid using
git add . and instead use
git add -A.
At that time, I never thought about it, I just assumed I was doing it wrong, until yesterday I was wondering why there are two ways to add files to the stage area.
When you add files with
git add ., you are adding every single file in the current folder, or structure, or anything like that, It's ok, you can do that, you can even add
git add file.js for example.
But if you want to add any deletion, update and all changes in the other directories, in this case, you should use add
git add -A, this
-A means ALL.
Another way is to update only the updated files, without any test file, or some experimental code, in this case, you can use
git add -u, this
-u means UPDATE.
Easy to remember, right?
Top comments (2)
git add -i
I did read about it, but I didn't tried this. I'm curious about the "interactive mode" of these.