Git add -A and git commit one liner

When working with Git, I often find myself typing:

git add -A && git commit -m "My commit message"

This stages any changes including new files (which "git commit -am" doesn’t), marks any files that have been deleted from the working copy as removed and commits to the repository.

Following a quick Google search, and thanks to this handy git alias article, I created a “ca” (commit all) alias using:

git config --global '!git add -A && git commit'

Now committing all changes is as simple as:

git ca -m "My commit message"

This is a good solution, however I prefer adding the following function to my ~/.profile file:

function gca {
  git add -A && git commit -m "$1"

Which gets us to:

gca "My commit message"