Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

git
productivity
communitycreator

How to create Git Alias

Anjana Shankar

Overview

If you use Git frequently, using aliases will save you several keystrokes every time, every day. Setting up a git alias takes a few minutes.

Syntax

$ git config --global alias.<alias> <command>

Alias commands

Below are some of the aliases that we frequently use with git.

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.a add
git config --global alias.unstage "reset HEAD --"
git config --global alias.last "log -1 HEAD"
Aliases

Run commands using terminal

We can run the above commands in the terminal below to see the effect. We have cloned a dummy repository in the terminal. We can use it to test the aliases.

Terminal 1
Terminal

Note: The alias commands can be run from anywhere on our system, provided we have Git installed. Plus, we don’t need to be in a Git folder to use it.

RELATED TAGS

git
productivity
communitycreator
RELATED COURSES

View all Courses

Keep Exploring