Skip to content

Instantly share code, notes, and snippets.

@ikibalnyi
Last active September 4, 2019 22:46
Show Gist options
  • Save ikibalnyi/fe86d03977bdf846a8ebea94eb705dd5 to your computer and use it in GitHub Desktop.
Save ikibalnyi/fe86d03977bdf846a8ebea94eb705dd5 to your computer and use it in GitHub Desktop.
Git and bash aliases
alias gut="git"
alias gti="git"
dockerclean() {
docker rmi --force $(docker images -f 'dangling=true' -q)
}
[credential]
helper = store
[alias]
mr = !sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -
undo = reset --soft HEAD~1
b = checkout -
pl = pull
ch = checkout
dev = checkout develop
s = stash
sp = stash pop
st = status -sb
a = add .
am = !git a && git commit -m $1
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
xfetch = !systemd-resolve --flush-caches && git fetch
xpull = !systemd-resolve --flush-caches && git pull
xpush = !systemd-resolve --flush-caches && git push
amend = !git add -A && git commit --amend --no-edit
mc = merge --continue
ma = merge --abort
rc = rebase --continue
ra = rebase --abort
ls = "!cd \"${GIT_PREFIX:-.}\"; ldds -al"
upd = "!sh -c 'f() { \
echo \"Checkout $1\"; \
git checkout $1; \
echo \"Pull origin $1\"; \
git pull origin $1; \
echo \"Checkout back\"; \
git checkout -; \
}; f'"
dirty = "!f() { \
CHANGED=$(git status -s); \
if [ -n $CHANGED ]; then git stash --include-untracked; fi \
echo $CHANGED; \
if [ -n $CHANGED ]; then git stash pop; \
}; f"
update = "!sh -c \"f() { \
CHANGED=$(git status -s); \
[[ -z $CHANGED ]] || echo 'Stashing' && git stash --include-untracked -q; \
git upd $1; \
[[ -z $CHANGED ]] || echo 'Puting changes back' && git stash pop; \
}; f\""
umerge = "!sh -c \"f() { \
CHANGED=$(git status -s); \
[[ -z $CHANGED ]] || echo 'Stashing' && git stash --include-untracked -q; \
git upd $1; \
git merge $1; \
[[ -z $CHANGED ]] || echo 'Puting changes back' && git stash pop; \
}; f\"";
urebase = "!f() { \
CHANGED=$(git status -s); \
[[ -z $CHANGED ]] || git stash --include-untracked; \
git pure-update $1; \
git rebase $1; \
[[ -z $CHANGED ]] || git stash pop; \
}; f";
[core]
fileMode = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment