Skip to content

Instantly share code, notes, and snippets.

@bnguyensn
Created March 17, 2021 13:32
Show Gist options
  • Save bnguyensn/5c66d70b7dd49429e254330674748734 to your computer and use it in GitHub Desktop.
Save bnguyensn/5c66d70b7dd49429e254330674748734 to your computer and use it in GitHub Desktop.
git aliases

Contains useful git aliases for .gitconfig

[alias]
	st = status
	
	aa = add .
	ca = "!git add . && git commit"
	c = commit
	cm = commit -m
	
	# list branches sorted by last modified
    b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
	co = checkout
	cb = checkout -b
	bd = branch -d
	bD = branch -D
	
	pu = push -u origin HEAD
	p = push origin HEAD
	
	rpo = remote prune origin
	
	# Logging
	l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
	
	# list aliases
    la = "!git config -l | grep alias | cut -c 7-"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment