The Lucid
Photo of The Lucid

UX Designer, CSS Wizard, Ruby on Rails Developer.

Using git add -A

In my day-to-day Git workflow I often find myself doing the the following before a commit:

git add .
git add -u
git status

The first line adds any new or modified file contents to the Git index and the second uses the “update” flag which marks any deleted files as deleted in the Git index. I then proceed with a commit and all my changes are committed.
I find myself repeating this before every commit and so had a browse of the documentation to see if there was a simpler way. I found the “-A” or “–all” flag which I had never noticed before (is this new?). Now my commits are usually a two step process:

git add -A
git commit -m "Committing all changed and deleted files"

Hope someone finds this useful.