DEV Community


Discussion on: GitSheet - my git cheatsheet

goodevilgenius profile image
Dan Jones

I would personally recommend not using git add . aside from the initial commit.

It's too easy to accidentally commit files you didn't mean to (temp files you were taking notes in, or even worse, files you were putting credentials in). Hopefully, you catch it when you do git status before you commit, but not adding in the first place is even better.

I prefer doing

git status # Check what's been changed
git add path/to/file some/full/dir/
git status # Check once more
git commit -m '😃 Some stuff'
Enter fullscreen mode Exit fullscreen mode
myrtle profile image
Mrtl Author

You are right, add-all can be dangerous. Personally I trust my sanity checks so I use it a lot, for speed, and then I may remove the occasional unwanted file, if any.
I will update for clarity. cheers