Skip to content

git commit -a

gautemeekolsen profile image Gaute Meek Olsen twitter logo github logo ・1 min read

Today I learned that you can add -a to a commit command to automatically stage files that have been modified and deleted.

Why write two lines:

git add .
git commit -m "msg"

When you can write one:

git commit -m "msg" -a

NB: new files you have not told Git about are not affected.

twitter logo DISCUSS (5)
markdown guide

Nice! Thank you, that is one hyphen and one space I am happy to get rid of :D


Although its a nice command, I prefer using git add -p first, so I can review each modification and decide whether to stage it or not.
I'ts one step more for sure, but saved me of commiting unecessary changes


Lovely! I didn't know about the -p flag. Definitely going to use this one from time to time. Thank you.

Classic DEV Post from Jul 30 '19

PublishTo.Dev: Scheduling article publishing on

Gaute Meek Olsen profile image
Developer at heart