Skip to content

Instantly share code, notes, and snippets.

@fferrin
Last active January 19, 2022 16:02
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 fferrin/1862e2cd9927ae340f306da6563ba0d8 to your computer and use it in GitHub Desktop.
Save fferrin/1862e2cd9927ae340f306da6563ba0d8 to your computer and use it in GitHub Desktop.
[alias]
co = checkout
d = diff
difflast = diff HEAD~1 HEAD
difflastname = diff --name-only HEAD~1 HEAD
b = branch
cm = commit -m
cmn = commit --no-verify -m
s = status
st = stash
stp = stash pop
sta = stash apply
stu = stash --keep-index -u
a = add
ln = log --oneline -n
cma = commit --amend
ln1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
ln2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
#lnbranch = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all --first-parent HEAD
fire = "!git add -A && git commit -m 'FIRE FIRE FIRE' && git push origin fire-branch"
delete-merged-branches = "!git co master && git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
update = "!f() { current_branch=$(git rev-parse --abbrev-ref HEAD); git stash && git checkout master && git pull origin master && git checkout $current_branch && git rebase master && git stash pop; }; f"
diffb = "!f() { from=master; if [ $# -eq 1 ]; then from=\"$1\"; fi; git diff --name-only $(git merge-base $from HEAD) HEAD; }; f"
compress= "!f() { from=master; if [ $# -eq 1 ]; then from=\"$1\"; fi; git reset --soft $(git merge-base $from HEAD); }; f"
diffname = diff --name-only
find = "!f() { git grep \"$1\" $(git rev-list --all); }; f"
recentb = "!r() { refbranch=$1 count=$2; git for-each-ref --sort=-committerdate refs/heads --format='%(refname:short)|%(HEAD)%(color:yellow)%(refname:short)|%(color:bold green)%(committerdate:relative)|%(color:blue)%(subject)|%(color:magenta)%(authorname)%(color:reset)' --color=always --count=${count:-20} | while read line; do branch=$(echo \"$line\" | awk 'BEGIN { FS = \"|\" }; { print $1 }' | tr -d '*'); ahead=$(git rev-list --count \"${refbranch:-master}..${branch}\"); behind=$(git rev-list --count \"${branch}..${refbranch:-master}\"); colorline=$(echo \"$line\" | sed 's/^[^|]*|//'); echo \"$ahead|$behind|$colorline\" | awk -F'|' -vOFS='|' '{$5=substr($5,1,70)}1' ; done | ( echo \"ahead|behind||branch|lastcommit|message|author\\n\" && cat) | column -ts'|';}; r"
rewind-to = "!f() { from=master; if [ $# -eq 1 ]; then from=\"$1\"; fi; git diff --name-only $(git merge-base $from HEAD) HEAD; }; f"
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[push]
default = current
[core]
editor = vim
[url "https://"]
insteadOf = git://
[branch]
sort = -committerdate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment