Skip to content

Instantly share code, notes, and snippets.

@tgdev
Last active August 20, 2021 00:35
Show Gist options
  • Save tgdev/7ec2191dd7f1830d7a34269ef33b0d72 to your computer and use it in GitHub Desktop.
Save tgdev/7ec2191dd7f1830d7a34269ef33b0d72 to your computer and use it in GitHub Desktop.
Git aliases
# Some taken from https://gist.github.com/mwhite/6887990
# How to add to global gitconfig using vscode:
1. Set VS Code as git config editor: git config --global core.editor "code --wait"
2. Edit git config with VS Code: git config --global -e
# ========================================================================================
[alias]
s = status
a = add
aa = add . #add all
c = commit -m #commit w/ message
ac = "!git aa && git commit -m" #add and comit w/ message
acs = "!git ac \"$1\" # --no-verify" #add, commit & skip pre-commit hook
co = checkout
cob = checkout -b
com = checkout master
mm = merge master
mom = merge origin master
b = branch
ba = branch -a #show all branches (local and remote)
br = branch -r #show remote branches
dl = branch -D #force delete local branch
dr = push origin --delete #delete remote branch
p = push
pu = push -u origin
pl = pull
plm = pull origin master
f = fetch --prune
rao = remote add origin
rv = revert
rs = reset
rsh = reset --hard
rsm = git checkout origin/master # reset file on branch to master version
st = stash save
sta = stash apply
std = stash drop
cl = clean -f #remove files from WD
clp = clean -n #preview files to be removed from WD
la = "!git config -l | grep alias | cut -c 7-"
lg = log --color --graph --pretty=format:"%C(cyan)%h%C(yellow)%d\\ %Creset%s%C(green)\\ [%cn]" --abbrev-commit --decorate
lf = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment