There is not an -A
option for commit
. Some say it would do more harm than good, committing files you didn't know were there.
However you can still do what you're looking to do: commit it all with just one command.
One command land, here we come!
You can turn any number of commands into one with something called an alias—it's just another name that you can tell git to recognize as a command—you just need to define it. What you name the alias is up to you.
Aliases you could create
- ✅
git ca
, if you want brevity; ca
standing for "commit all" or
- ✅
git commit-all
to match existing git conventions.
You can't make an alias that looks like this
Here's how
To add an alias, open up your user-level git configuration by running
git config --global --edit
Then, under the [alias]
section, add this line:
[alias]
ca = !git add -A && git commit -av
The !
allows multiple commands in an alias.
Finally, save and close the file.
A word of warning
🎉Tadah! Now you can run git ca
to add and commit all the changes in your repository.
However, using this puts you at risk of committing things you didn't intend to commit, so proceed with caution. Good luck!
Here's a list of other useful aliases you might consider.