Skip to content

Instantly share code, notes, and snippets.

@markatom
Last active February 12, 2017 18:39
Show Gist options
  • Save markatom/c427b235935b838afe7c992d6c8f53f5 to your computer and use it in GitHub Desktop.
Save markatom/c427b235935b838afe7c992d6c8f53f5 to your computer and use it in GitHub Desktop.
[core]
excludesfile = ~/.gitignore
editor = nano
[user]
name = Tomáš Markacz
email = [email protected]
[pretty]
custom = %Cblue%h %Cgreen%an %C(yellow)%ar%Cred%d%n%Creset%s
[rerere]
enabled = true
[alias]
a = add
aa = add --all
ai = add --interactive
c = commit
ca = commit --all
cam = commit --all --amend
cf = commit --fixup
cm = commit --amend
d = diff
dc = "! { \
git diff HEAD --color; \
for untracked in `git ls-files --others --exclude-standard`; do \
git diff --color /dev/null $untracked; \
done; \
} | less"
do = !git diff HEAD origin/`git current-branch`
ds = diff --staged
e = reset
ec = "!git reset --hard HEAD; git clean -df"
eh = reset --hard
eho = !git reset --hard origin/`git current-branch`
f = fetch
l = log --graph --pretty=custom --no-color
la = !git l --all
lf = !git l --first-parent
lm = !git l master..HEAD
lo = !git l HEAD...origin/`git current-branch`
m = merge
mn = merge --no-ff
mo = !git merge --ff-only origin/`git current-branch`
o = checkout
ob = checkout -b
om = checkout --merge
p = push
pf = push --force-with-lease
pu = push --set-upstream origin HEAD
r = rebase
ra = rebase --abort
rc = rebase --continue
ri = rebase -i --autosquash
ro = rebase --onto
s = status --untracked-files
t = stash
ta = stash apply
tb = stash branch
td = stash drop
tl = stash list
tp = stash pop
ts = stash save
tsp = stash save --patch
tw = stash show
w = show
branch-cleanup = "! \
git checkout -q master; \
echo $'\\e[32mRemoving stale remote-tracking branches\\e[0m'; \
git remote prune origin; \
echo $'\\e[32mRemoving merged local branches\\e[0m'; \
git branch --merged master | sed -e '/ master$/d' | cut -d ' ' -f 3 | xargs git branch -d; \
echo $'\\e[32mInteractively removing unmerged local branches without remote-tracking branches\\e[0m'; \
BRANCHES=`{ \
git branch -vv | grep -v ' [origin/'; \
git branch -vv | grep ': gone]'; \
} | cut -d ' ' -f 3`; \
for BRANCH in $BRANCHES; do \
git checkout -q $BRANCH; \
read -p \"Delete branch $BRANCH [Y/n]? \"; \
[[ $REPLY =~ ^[Yy]?$ ]] && git checkout -q master && git branch -D $BRANCH; \
done; \
"
current-branch = rev-parse --abbrev-ref HEAD
current-hash = rev-parse HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment