Skip to content

Instantly share code, notes, and snippets.

@withakay
Last active October 12, 2024 19:59
Show Gist options
  • Save withakay/186bcc90571dffb0f0fef62c3ee6831a to your computer and use it in GitHub Desktop.
Save withakay/186bcc90571dffb0f0fef62c3ee6831a to your computer and use it in GitHub Desktop.
My git config
[user]
name = withakay
email = [email protected]
[core]
excludesfile = ~/.gitignore_global
editor = vim
[push]
default = current
autoSetupRemote = true
followTags = true
[alias]
# List all aliases :)
laa = "!git config -l | grep alias | cut -c 7-"
# list aliases with comments using aws. See ~/.local/bin/git-list-aliases
la = list-aliases
# many borrowed from https://gist.github.com/th3hunt/14330f3a61161eeeeddb22eb5e939854
a = add
aa = add -A
br = branch
co = checkout
ci = commit
ca = commit -a
st = status
pl = pull
pr = pull --rebase
pu = push
rh = reset --hard
rs = restore --
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
type = cat-file -t
dump = cat-file -p
# Clean oneline log
l = log --graph --pretty=format':%C(yellow)%h%C(auto)%d%Creset %Creset%s %C(242)<%an>%Creset'
# Oneline log with dates
ll = log --graph --pretty=format':%C(yellow)%h%C(auto)%d%Creset %Creset%s %C(dim 11)(%ar) %C(246)<%an>%Creset'
# Log with stats
ls = log --pretty=format':%C(yellow)%h%C(auto)%d%Creset %Creset%s %C(242)<%an>%Creset' --stat --no-merges
# show current branch
cb = rev-parse --abbrev-ref HEAD
# find parent branch
pb = !"git show-branch -a | ack '\\*' | ack -v \"`git cb`\" | head -n1 | sed 's/.*\\[\\(.*\\)\\].*/\\1/' | sed 's/[\\^~].*//'"
# Show the last tag
lt = describe --tags --abbrev=0
filediff = diff --name-only
last = log -1 HEAD
fixup = commit --fixup
undo = reset HEAD~1 --mixed
unstage = reset HEAD --
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
# delete merged branches
bclean = "!f() { git branch --merged ${1-main} | grep -v " ${1-main}$" | xargs -r git branch -d; }; f"
bclean-old = "!f() { git branch --merged ${1-master} | grep -v " ${1-master}$" | xargs -r git branch -d; }; f"
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[commit]
#template = /Users/jack/.stCommitMsg
[rerere]
enabled = 1
[init]
defaultBranch = main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment