Skip to content

Instantly share code, notes, and snippets.

@VasekPurchart
Last active July 8, 2023 18:29
Show Gist options
  • Star 32 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save VasekPurchart/1109501 to your computer and use it in GitHub Desktop.
Save VasekPurchart/1109501 to your computer and use it in GitHub Desktop.
GIT global configuration and enhancements
# used by Git (commit messages, rebase, ...)
export EDITOR=vim
[user]
name = Vasek Purchart
email = me@vasekpurchart.cz
[core]
# windows->true, linux-> input
autocrlf = input
safecrlf = false
# must be absolute path
excludesfile = /home/Vasek/.gitignore_global
[alias]
f = fetch
# updates your branch with upstream (if fast-forward is possible)
ff = !git merge --ff-only `git rev-parse --symbolic-full-name --abbrev-ref=strict HEAD@{u}`
fp = fetch --prune
st = status
cm = commit
cma = commit --amend
br = branch
co = checkout
cp = cherry-pick
df = diff
rb = rebase
rbi = rebase -i
rbc = rebase --continue
rh = reset --hard
su = submodule update
# graph for current branch
l = log --graph --decorate --pretty=oneline --abbrev-commit
# graph for all branches
ll = log --graph --decorate --pretty=oneline --abbrev-commit --all
# log for current branch showing diffs (-m is for showing mergecommits too)
ld = log -p -m
# log for current branch showing summary of changed files (-m is for showing mergecommits too)
ls = log --stat -m
# number of commits for each person
stats = shortlog -n -s --no-merges
# remove remote branch (remote must be named origin), usage: git rmb test
rmb = !sh -c 'git push origin :$1' -
# shows local > tracked remote
brt = for-each-ref --format=\"%(refname:short) > %(upstream:short)\" refs/heads
# get upstream tracked branch or error
brtracked = rev-parse --symbolic-full-name --abbrev-ref=strict HEAD@{u}
# commit all changes to a WIP commit
wip = !git add --all && git commit -m WIP
[diff]
mnemonicprefix = true
[pull]
rebase = true
[push]
default = current
[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 = green
changed = yellow
untracked = cyan
*.log
nbproject
.idea
######################
# OS generated files #
######################
.DS_Store
ehthumbs.db
Icon
Thumbs.db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment