Skip to content

Instantly share code, notes, and snippets.

@stuartleeks
Last active November 22, 2021 08:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartleeks/7d91a111511f9c9fe93421aba71d5a19 to your computer and use it in GitHub Desktop.
Save stuartleeks/7d91a111511f9c9fe93421aba71d5a19 to your computer and use it in GitHub Desktop.
My notes for my .gitconfig
[core]
editor = code --wait
[diff]
tool = default-difftool
[difftool "default-difftool"]
cmd = code --wait --diff $LOCAL $REMOTE
[alias]
amendcommit = "!git commit --amend --reuse-message \"$(git rev-parse --abbrev-ref HEAD)\""
branches = branch -a --color -v
wip = !git add -A && git commit -qm "WIP"
sv = status -vv
undo = reset HEAD~1 --mixed
pr = "! f() { git fetch upstream pull/$1/head:pr-$1; git checkout pr-$1; }; f"
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
fl = log -u
logtree = log --graph --oneline --decorate --all
add-azdo-pr-refs=config --add remote.origin.fetch +refs/pull/*/merge:refs/remotes/origin/pr/*
show-remote = "! f() { CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD); REMOTE_BRANCH=$(git for-each-ref --format='%(refname:short):%(upstream:short)' refs/heads | grep $CURRENT_BRANCH: | sed -E 's/.*:(.*)/\\1/'); echo Remote tracking branch for $CURRENT_BRANCH is $REMOTE_BRANCH; }; f"
overwrite-local-with-remote = "! f() { echo starting...;CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD); REMOTE_BRANCH=$(git for-each-ref --format='%(refname:short):%(upstream:short)' refs/heads | grep $CURRENT_BRANCH: | sed -E 's/.*:(.*)/\\1/'); echo Checking out $REMOTE_BRANCH;git checkout $REMOTE_BRANCH;echo Checking out as $CURRENT_BRANCH; git checkout -B $CURRENT_BRANCH ;}; f"
[help]
autocorrect = 1
[merge]
conflictstyle = diff3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment