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.

Published by

Jamie

Hi, I am the Managing Director of SonicIQ Limited in the UK. I have been working in the web development industry since 1999 and have been running SonicIQ since 2001. Currently Ruby On Rails is my preferred development platform. I am experienced in designing with web standards, HTML5, CSS3 and Javascript.

7 thoughts on “Using git add -A”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>