re: How to master the art of Git VIEW POST


git add -A is an anti-pattern, please don't recommend it as a rule of thumb!

Use git status to list files and git add for each file you want/need to add. Then learn about git add -i (or git add -p), or use GUIs for a point-and-click UX (I personally use git citool most of the time, and git add -p when I need to edit a hunk, but this is quite rare).

The rule of thumb really is not to forget that this is about "version control" (like any VCS), and not some backup tool. Commits, commit logs and commit history need to be crafted with care and love, for your coworkers/contributors, and your future self.

Learn about the existence of git blame and git bisect (assuming you already know and use git log and/or gitk or similar tool) to understand why a clean history is good for you.

Those are my advice.

code of conduct - report abuse