Skip to content

Instantly share code, notes, and snippets.

@Koriit
Last active March 10, 2023 14:08
Show Gist options
  • Save Koriit/6384a9a5d892ce6677b013f314fc089d to your computer and use it in GitHub Desktop.
Save Koriit/6384a9a5d892ce6677b013f314fc089d to your computer and use it in GitHub Desktop.
My git configuration
#!/bin/sh
git config --global alias.discard "checkout --"
git config --global alias.wh "diff --check"
git config --global alias.cp "cherry-pick"
git config --global alias.co "checkout"
git config --global alias.stat "status"
git config --global alias.mt "mergetool"
git config --global alias.br "branch"
git config --global alias.unstage "reset HEAD --"
git config --global alias.sl "stash list"
git config --global alias.sd "stash drop"
git config --global alias.sp "stash pop"
git config --global alias.sa "stash apply"
git config --global alias.ss "stash save"
git config --global alias.ls "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' --abbrev-commit --date=relative"
git config --global alias.ll "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' --abbrev-commit --date=relative --numstat"
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' --abbrev-commit --date=relative --all"
git config --global alias.vertag '!echo "Last version tag: `git tag --list v* --sort=-v:refname | head -n1`"'
git config --global alias.ecg "config --global -e"
git config --global alias.ecl "config --local -e"
git config --global alias.st '!git ls -1 && git status -sb'
git config --global alias.wip '!git add --all && git commit `if [ "$(git log -1 --format="%s")" = "WIP" ]; then echo "--amend"; fi` -m "WIP"'
# Note: depends on "open" command capable of opening URLs
git config --global alias.hub '!bash -ic "open $(git remote get-url origin)"'
git config --global alias.lab "hub"
git config --global alias.pp "pull --prune"
git config --global alias.pu "push"
# Note: depends on curl and jq
git config --global alias.hubrepos '!bash -ic "curl https://api.github.com/users/`git config github.user`/repos -s | jq \".[].full_name\" -r | sort"'
# Note: depends on notepad++ available on the PATH as npp
git config --global core.editor "npp -multiInst -notabbar -nosession -noPlugin"
git config --global pull.ff only
git config --global advice.statusHints false
git config --global advice.pushNonFastForward false
git config --global merge.stat true
git config --global merge.tool meld
git config --global merge.tool meld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment