Git Aliases Are Like Superpowers

Dale Zak
1 min readJun 9, 2021

Using Git Aliases can make you feel like you have superpowers!

It wasn’t until recently that I discovered Git Aliases, they are so handy that I seriously don’t know how I lived without them. These are two that I use every day now.

Git Add Commit Push

git config — global alias.add-commit-push '!git add -A && git commit -m "$1" && git push && git status'

Once the alias has been added you can now add, commit and push all on one line.

git add-commit-push "Add, commit, push in one line!"

Git New Branch

git config --global alias.new-branch '!git checkout -b "$1" && git add -A && git commit -m "$2" && git push -u origin "$1" && git status'

This alias adds, commits and pushes current changes to a new branch.

git new-branch "123-my-branch" "Checkout, add, commit, push!"

Checkout the Git documentation for other alias ideas. Enjoy!

--

--

Dale Zak
Dale Zak

Written by Dale Zak

Full stack developer specializing in web apps built on Rails with Stimulus, and mobile apps using Ionic and Vue.