Skip to content

Instantly share code, notes, and snippets.

@mbektchiev
Last active February 7, 2020 09:11
Show Gist options
  • Select an option

  • Save mbektchiev/fa9f65d141fdde5b35e2 to your computer and use it in GitHub Desktop.

Select an option

Save mbektchiev/fa9f65d141fdde5b35e2 to your computer and use it in GitHub Desktop.
My global gitconfig
[advice]
detachedHead = false
[user]
email = [email protected]
name = Martin Bektchiev
[push]
default = current
[alias]
start = !git init && git add . && git commit -m "Init" && git status
f = fetch
p = push -u
cp = cherry-pick
cpc = cherry-pick --continue
co = checkout
s = status
st = status
br = branch
ci = commit --all
dif = diff
d = diff
difs = diff --submodule=diff
pf = push -u --force-with-lease
push = push -u
ds = diff --staged
fetcha = fetch --all --prune --tags
amend = commit --all --amend --reuse-message HEAD
oops = reset --soft HEAD~1
ec = config --global -e
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
cob = checkout -b
wip = !git add -u && git commit --all -m "WIP"
discard = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard
bclean = "!f() { git branch --merged ${1-HEAD} | grep -v " ${1-some-dummy-value-thats-not-to-be-found}$" | grep -v 'HEAD detached' | xargs git branch -d; }; f"
bdone = "!f() { git checkout ${1-release} && git up && git bclean ${1}; }; f"
rbc = rebase --continue
rbab = rebase --abort
rb = !git fetch && git rebase
rbi = !git fetch && git rebase -i
approved = "!f() { git fetch && git rebase -i origin/${1-master}; }; f"
mt = mergetool
ma = merge --abort
mc = merge --continue
su = !git submodule init && git submodule update --recursive `git status | grep 'new commits' | awk '{print $2}'`
authors = !"git log --all --format='%cN <%cE>' | sort -u"
master = !git fetch -p && git checkout origin/master
release = !git fetch -p && git checkout origin/release
# various pretty loggers from various places
stashl = stash list --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(cyan)%an%Creset'
l = log --pretty=oneline --abbrev-commit
rlg = reflog --pretty=format:'%Cred%h%Creset %C(yellow)%gs%Creset %s %Cgreen(%cd)%Creset %C(cyan)%an%Creset'
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cd)%Creset %C(cyan)%an%Creset' --abbrev-commit --date=local
lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cd)%Creset %C(cyan)%an%Creset' --abbrev-commit --date=local --all
lc = log ORIG_HEAD.. --stat --no-merges
# from http://blog.kfish.org/2010/04/git-lola.html
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
ll = log --graph --date=short
add-symlink = "!__git_add_symlink(){\n argv=($@)\n argc=${#argv[@]}\n\n # Look for options\n options=(\" -h\")\n o_help=\"false\"\n case \"${argv[@]}\" in *\" -h\"*) o_help=\"true\" ;; esac\n if [ \"$o_help\" == \"true\" -o \"$argc\" -lt \"2\" ]; then\n echo \"\\\nUsage: git add-symlink <src> <dst>\n\n* <src> is a RELATIVE PATH, respective to <dst>.\n* <dst> is a RELATIVE PATH, respective to the repository's root dir.\n* Command must be run from the repository's root dir.\"\n return 0\n fi\n\n src_arg=${argv[0]}\n dst_arg=${argv[1]}\n\n dst=$(echo \"$dst_arg\")/../$(echo \"$src_arg\")\n if [ ! -e \"$dst\" ]; then\n echo \"ERROR: Target $dst does not exist; not creating invalid symlink.\"\n return 1\n fi\n\n hash=$(echo -n \"$src_arg\" | git hash-object -w --stdin)\n git update-index --add --cacheinfo 120000 \"$hash\" \"$dst_arg\"\n git checkout -- \"$dst_arg\"\n\n}; __git_add_symlink \"$@\""
unstage = reset HEAD --
[branch]
autosetuprebase = always
[checkout]
defaultRemote=origin
[pull]
rebase = true
[diff]
submodule = short
tool = p4mergetool
[core]
editor = code -n -w
excludesfile = /Users/bektchiev/.gitignore_global
autocrlf = input
[difftool "sourcetree"]
cmd = /Applications/p4merge.app/Contents/MacOS/p4merge \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/p4merge.app/Contents/MacOS/p4merge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
trustExitCode = true
[merge]
tool = p4mergetool
renamelimit = 100000
[mergetool "p4mergetool"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge $PWD/$BASE $PWD/$REMOTE $PWD/$LOCAL $PWD/$MERGED
trustExitCode = false
[mergetool]
keepBackup = false
[difftool "p4mergetool"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge $LOCAL $REMOTE
[commit]
template = /Users/bektchiev/.stCommitMsg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment