Skip to content

Instantly share code, notes, and snippets.

@subhransu
Created September 29, 2025 16:14
Show Gist options
  • Select an option

  • Save subhransu/f39fcc414c5957de2a49973c19d0cd79 to your computer and use it in GitHub Desktop.

Select an option

Save subhransu/f39fcc414c5957de2a49973c19d0cd79 to your computer and use it in GitHub Desktop.
Git aliases for faster workflow
[alias]
co = checkout
cob = checkout -b
cm = commit -m
ca = commit --amend
s = status -sb
st = status
aa = add --all
ap = add -p
br = branch
brr = branch -r
l = log --oneline --decorate --graph --all
ls = log --graph --decorate --pretty=oneline --abbrev-commit
ll = log --oneline --graph
hist = log --pretty=format:'%C(yellow)%h%Creset %ad | %s %Cgreen%d%Creset [%an]' --graph --date=short
who = shortlog -sne
rom = rebase origin/main
rc = rebase --continue
rs = rebase --skip
ra = rebase --abort
pl = pull --rebase
ps = push
pf = push -f
pu = push -u origin HEAD
d = diff
ds = diff --staged
sa = stash apply
sl = stash list
ss = stash save
sp = stash pop
@subhransu
Copy link
Author

Setup

Option 1: Add directly to global config

git config --global --edit

Paste the [alias] block into the opened file.

Option 2: Save in a separate file

Create ~/.git-aliases with the alias block, then include it:

git config --global include.path ~/.git-aliases

Usage Examples

Alias Command Example
co checkout git co main
cob checkout -b git cob feature/login
cm commit -m git cm "Fix bug"
ca commit --amend git ca
s status -sb git s
l log --oneline --decorate --graph --all git l
hist custom log format git hist
who shortlog -sne git who
rom rebase origin/main git rom
pl pull --rebase git pl
pu push -u origin HEAD git pu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment