Ad space (banner)
🌿Git Lessons
Lesson 37 / 59

Staging and Committing Together with git commit -a

This lesson covers staging and committing together with git commit -a. It's for anyone searching "git commit -a usage."

git commit -a is a convenient option that lets you commit changes to files Git already tracks, skipping the separate git add step.

In Try It, run git commit -a -m "Batched commit". Every change to already-tracked files gets staged and committed in one motion.

A common early mistake is expecting this to work on newly created files — it doesn't; -a only applies to files Git already tracks, so a brand-new file still needs a separate git add. In real teams, this option is useful whenever you want to quickly commit a small tweak to an existing file, skipping a step in the process.

Git
Try it (type this into the pseudo terminal)
git commit -a -m "Batched commit"

🧑‍💻 You can type this command into the Git pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)