Skip to content

Instantly share code, notes, and snippets.

@bhishp
Last active February 25, 2020 10:35
Show Gist options
  • Save bhishp/311d9d9aabf7b155b2d668fef1665cd3 to your computer and use it in GitHub Desktop.
Save bhishp/311d9d9aabf7b155b2d668fef1665cd3 to your computer and use it in GitHub Desktop.
[alias]
# one-line log
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
a = add
ap = add -p
c = commit --verbose
ca = commit -a --verbose
cm = commit -m
cam = commit -a -m
camnv = commit -a --no-verify -m
# commit and message and push
camp = "!f() { git cam \"$1\" && git push; }; f"
m = commit --amend --verbose
pd = "!git co develop && git pull"
pm = "!git co master && git pull"
# create a new branch and push up to remote
claim = "!f() { git cob $1 && git push --no-verify -u origin $1; }; f"
# cleanup merged branches
bclean = "!f() { \
for branch in $((git branch | cut -c 3-) | awk '!/develop/ && !/master/' | tr '\n' ' '); do \
git branch -d $branch; \
done; \
git fetch -p; \
}; f"
d = diff
ds = diff --stat
dc = diff --cached
s = status -s
co = checkout
cob = checkout -b
# list branches sorted by last modified
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
# list aliases
la = "!git config -l | grep alias | cut -c 7-"
# pull including submboles
ps = submodule update --recursive --remote
# co master and pull
pullm = "!git co master && git pull"
# rebase onto origin/master
rebaseo = "!git fetch && git rebase origin/master"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment