Git commit alias

As a developer, this will feel familiar. You make a small change, and then repeatedly type the same Git commands:

  • git add .
  • git commit -m “my change”
  • git push

It works… but it’s repetitive, and costs unnecessary time. So you might start wondering: Can I combine these three commands into one? The answer is yes, by using Git alias.

With a simple alias, you can turn those three steps into a single, clean command:

git pushm “comment”

To set this up, you define a custom alias in Git:

git config --global alias.pushm '!f() { git add . && git commit -m "$1" && git push; }; f'

From that point on, your workflow becomes much smoother:

git pushm "updated API endpoint"

See also: