Skip to content

Instantly share code, notes, and snippets.

@vitek-rostislav
Created June 19, 2018 14:04
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 vitek-rostislav/6d778ce9413baeac855e140d59d5e577 to your computer and use it in GitHub Desktop.
Save vitek-rostislav/6d778ce9413baeac855e140d59d5e577 to your computer and use it in GitHub Desktop.
f = fetch
# updates your branch with upstream (if fast-forward is possible)
ff = !git merge --ff-only `git rev-parse --symbolic-full-name --abbrev-ref=strict HEAD@{u}`
fp = fetch --prune
st = status
cm = commit
cma = commit --amend
br = branch
co = checkout
cp = cherry-pick
df = diff
rb = rebase
rbi = rebase -i --autosquash
rbc = rebase --continue
rh = reset --hard
su = submodule update
# graph for current branch
l = log --graph --decorate --pretty=oneline --abbrev-commit
# graph for all branches
ll = log --graph --decorate --pretty=oneline --abbrev-commit --all
# graph for all branches including commit time and author
lll = log --graph --decorate --all --date-order \"--pretty=format:%C(yellow)%h%C(reset)%C(auto)%d %s %C(green)(%ai%x08%x08%x08%x08%x08%x08)%C(reset) %C(blue)<%an>%C(reset)\"
# log for current branch showing diffs (-m is for showing mergecommits too)
ld = log -p -m
# log for current branch showing summary of changed files (-m is for showing mergecommits too)
ls = log --stat -m
# number of commits for each person
stats = shortlog -n -s --no-merges
# remove remote branch (remote must be named origin), usage: git rmb test
rmb = !sh -c 'git push origin :$1' -
# shows local > tracked remote
brt = for-each-ref --format=\"%(refname:short) > %(upstream:short)\" refs/heads
# get upstream tracked branch or error
brtracked = rev-parse --symbolic-full-name --abbrev-ref=strict HEAD@{u}
# commit all changes to a WIP commit
wip = !git add $(git rev-parse --show-toplevel) && git commit -m WIP
# reset last WIP commit
unwip = "!sh -c 'if [ -n \"$(git log -n 1 --format=\\\"format:%s\\\"|grep WIP)\" ]; then git reset --soft HEAD~1; else echo \"No WIP to unwip\"; fi'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment