Skip to content

Instantly share code, notes, and snippets.

@Mitko-Kerezov
Created July 2, 2018 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mitko-Kerezov/f7e8dbfe28dc04057eabe251a3db122b to your computer and use it in GitHub Desktop.
Save Mitko-Kerezov/f7e8dbfe28dc04057eabe251a3db122b to your computer and use it in GitHub Desktop.
Git aliases
[alias]
dw = diff -w
co = checkout
st = status
br = branch
pish = push
cob = checkout -b
bclean = "!f() { git branch --merged ${1-origin/master} | grep -v " ${1-master}$" | xargs -r git branch -d; }; f"
l = log --pretty=oneline --abbrev-commit
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(cyan)%an%Creset' --abbrev-commit --date=relative
oops = reset --soft HEAD~1
back = reset --hard HEAD~1
ec = config --global -e
mt = mergetool
pushf = push --force-with-lease
pishf = pish --force-with-lease
pl = pull --prune
su = submodule update
ps = "!f() { git pl; git su; }; f"
cma = "!f() { git add -A; git commit --all -m \"$1\"; }; f"
cli = "!f() { git fetch -p && git co ${1-master} && git ps; }; f"
clig = "!f() { git co ${1-master} && git ps && grunt rebuild; }; f"
tool = "!f() { git co ${1-master} && git pull && git submodule sync && git su; }; f"
sub = submodule update --recursive
wipe = "!f() { git reset --hard; git clean -ffdx; }; f"
ca = commit --amend --no-edit
caa = "!f() { git add --all; git ca; }; f"
base = "!f() { git fetch; git rebase origin/${1-master}; }; f"
delete-tag = "!f() { git fetch; git tag -d $1; git push origin :refs/tags/$1; }; f"
inita = "!f() { git init; git cma initial; }; f"
switch = "!f() { git stash && git base ${1-master} && git stash pop; }; f"
latest = "!f() { git co ${1-master} && git pl; }; f"
go-on = rebase --continue
apply-gitignore = !git ls-files -ci --exclude-standard -z | xargs -0r git rm --cached
grunt = "!f() { grunt "$@"; }; f"
rhard = "!f() { git fetch -p; git co ${1-master}; git reset --hard origin/${1-master}; }; f"
cli-push = !grunt all && git push
cli-pushf = !grunt all && git pushf
wip = !git cma WIP && git push
wipf = !git caa WIP && git pushf
reorder = "!f() { git rebase -i HEAD~$1; }; f"
plush = !git pl && git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment