Are you tired of typing lengthy Git commands? Git aliases are here to save the day! They let you establish shortcuts for common commands, thus enhancing your productivity.
Let's explore two ways to set them up.
Method 1: Git Config Command
Before starting, make sure you have Git installed.
Initially, you can utilize your terminal:
git config --global alias.<alias-name> '<git-command>'
In this command, substitute <alias-name>
with your preferred alias, and <git-command>
with the actual Git command. For example:
git config --global alias.co 'checkout'
git config --global alias.st 'status'
Method 2: Editing the .gitconfig
File
Another approach involves making adjustments directly in your .gitconfig file, which is usually found in your home directory and add the following:
[alias]
st = status
co = checkout
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
The first method also adds to the .gitconfig
file, but directly editing the file tends to be a simpler process.
With these set up, you can now use git co
in lieu of git checkout
, and git st
instead of git status
. It's important to remember, these aliases are only applicable to your local machine.
Some users also prefer creating aliases in .bashrc
or .zshrc
files to abbreviate them even further, such as using gs
for git status
and gc
for git checkout
.
Top comments (17)
TIL about Git Alias 🔥
Thank you.
Helpful! Thanks for sharing this💯
Thank you, ANUSHKA for reading.
SMM Instagram involves using strategic social media marketing techniques to enhance brand visibility, engage with the target audience, and promote products or services on the platform.
An SMM reseller is a third-party service provider that offers social media marketing services to clients by purchasing and reselling them from wholesale sources, helping businesses and individuals enhance their online presence and engagement.
A Facebook SMM Panel is a social media marketing tool that provides a centralized platform for managing and optimizing various aspects of a Facebook marketing campaign, including content scheduling, analytics, and audience engagement.
I like
alias.make !make
to run
make
from project rootMaybe someone find some helpful git aliases here. 👍
github.com/voku/dotfiles/blob/mast...
An SMM panel is an online platform that provides social media marketing services, allowing users to buy likes, followers, and other engagement metrics to enhance their social media presence.
Here are some alias of mine if you wish :-)
gist.github.com/martinratinaud/f10...
Very handy to display a nice history for example
Great job!
Also, if you use ZSH shell with ohmyzsh, there are several handy
git
plugins