Skip to content

Instantly share code, notes, and snippets.

@alien11689
Last active July 3, 2025 13:34
Show Gist options
  • Save alien11689/4417efb3ccf7d855afda2d260f25b712 to your computer and use it in GitHub Desktop.
Save alien11689/4417efb3ccf7d855afda2d260f25b712 to your computer and use it in GitHub Desktop.
[user]
name = ...
email = ...
[core]
pager = less -r
excludesfile = ~/.gitignore
editor = vim
precomposeunicode = true
autocrlf = false
[column]
ui = auto
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[alias]
#based on https://github.com/jakubnabrdalik/gitkurwa
#those who don't know history, are doomed to repeat it
hist = log --pretty=format:'%Cred%h%Creset %C(bold blue)<%an>%Creset%C(yellow)%d%Creset %Cgreen(%cr)%Creset%n%w(80,8,8)%s' --graph
histfull = log --pretty=format:'%Cred%h%Creset %C(bold blue)<%an>%Creset%C(yellow)%d%Creset %Cgreen(%cr)%Creset%n%w(80,8,8)%s%n' --graph --name-status
llog = log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=iso
changelog = log --pretty=format:'%Cgreen%d %Creset%s' --date=iso
#wish i knew
whois = "!sh -c 'git log -i -1 --pretty=\"format::%an <%ae>\n\" --author=\"$1\"' -"
whatis = show -s --pretty='tformat::%h (%s, %ad)' --date=short
howmany = "!sh -c 'git log -a --pretty=oneline | wc -l'"
howmanybywhom = shortlog -sn
#what's going on, I don't even
anychanges = !sh -c 'git fetch' && git log --oneline HEAD..origin/$1
anychangesonmaster = !sh -c 'git fetch' && git log --oneline HEAD..origin/master
whoischanging = !sh -c 'git shortlog HEAD..origin/$0'
whoischangingmaster = !sh -c 'git shortlog HEAD..origin/master'
#what branches you have on origin, with info on who is guilty and how long ago. Useful for gitflow and feature branches in general. Requires fetch up-front.
showorigin = !sh -c "isHash=true; for i in `git ls-remote -h origin`; do [ ! -z $isHash ] && echo \" $i\" || printf \"%-8s %8s %-8s%-3s %-10s %-20s\" `git show -s --pretty=format:\"%C(yellow)%h %Cred%ad %Cblue%an\" --date=relative $i` ; [ ! -z $isHash ] && isHash=\"\" || isHash=true ; done"
#get remote branches
trackallbranches = !sh -c "for branchname in `git branch -r `; do git branch --track $branchname; done"
updateallbranches = !sh -c "for branchname in `git branch -r `; do git checkout $branchname ; git pull; done"
# fix .gitignore
fixgitignore = !git rm -r --cached . && git add . && git commit -m \"Just a .gitignore fix \"
#tags
showtags = show-ref --tags
pushtags = push --tags
tagwithdate = !sh -c 'git tag "$0"_$(date "+%y-%m-%d_%H-%M-%S")'
#better versions
purr = pull --rebase
difff = diff --color-words #just words
bbranch = branch -v
branches = branch -avvl
sth = stash -u
#what do I have in my toolbox?
alias = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\\t => \\2/' | sort
#fiat lux
makegitrepo = !git init && git add . && git commit -m \"initial commit\"
#Finds a filename in the git repository. Gives absolute location (from the git root).
find = !sh -c 'git ls-tree -r --name-only HEAD | grep --color $1' -
#Deletes all branches that were safely merged into the master. All other are skipped (no worries).
cleanup = !git branch --merged master | grep -v 'master$' | xargs git branch -d
cleanupMain = !git branch --merged main | grep -v 'main$' | xargs git branch -d
cleanupTrunk = !git branch --merged trunk | grep -v 'trunk$' | xargs git branch -d
#Deletes orphaned remote branches (.git/refs/remotes/origin), clean up reflog and remove all untracked files
cleanuplocal = !git remote prune origin && git gc && git clean -df
unstage = reset HEAD --
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
ca = commit -a
ci = commit
st = status
co = checkout
br = branch
#gerrit
push-for-review = push origin HEAD:refs/for/master
push-as-wip = push origin HEAD:refs/for/master%wip
push-as-draft = push origin HEAD:refs/drafts/master
push-for-review-branch = !git push origin HEAD:refs/for/$1
push-as-draft-branch = !git push origin HEAD:refs/drafts/$1
myBranches = "!sh -c \"git hist `git br | tr '\n' ' '| sed 's/*//g'`\""
please = push --force-with-lease
commend = commit --amend --no-edit
it = !git init && git commit -m “root” --allow-empty
stsh = stash --keep-index
staash = stash --include-untracked
staaash = stash --all
shorty = status --short --branch
merc = merge --no-ff
grog = log --graph --abbrev-commit --decorate --all --format=format:\"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(dim white) - %an%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)\"
checkout = "!sh -c \"USE switch OR restore\""
authors = "!sh -c \"git log --pretty=format:'%an | %s' | grep -v '\\[maven-release-plugin\\]' | cut -f1 -d\\| | sort | uniq -c | sort -rnk 1\""
current = "branch --show-current"
rebaseCommit = "!sh -c \"git rebase --onto $1 HEAD^ `git current`\""
[apply]
whitespace = nowarn
[help]
autocorrect = 1 #fucking magic!
[push]
default = simple
followTags = true
[diff]
tool = meld
#algorithm = histogram
colorMoved = plain
mnemonicPrefix = true
renames = true
[giggle]
main-window-maximized = false
main-window-geometry = 700x945+2048+106
file-view-vpane-position = 346
history-view-vpane-position = 771
main-window-view = FileView
[http]
sslVerify = true
[fetch]
prune = true
[branch]
sort = -committerdate
[tag]
sort = version:refname
[init]
defaultBranch = main
[commit]
verbose = true
*.iml
.idea
*.log
target
.DS_Store
.gradle
build
release.properties
pom.xml.releaseBackup
maven-cache
__pycache__
.sdkmanrc
.node-version
node_modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment