Skip to content

Instantly share code, notes, and snippets.

@oidualc
Last active June 24, 2026 21:07
Show Gist options
  • Select an option

  • Save oidualc/6601ca6d900c7f0784742a5a66910fd4 to your computer and use it in GitHub Desktop.

Select an option

Save oidualc/6601ca6d900c7f0784742a5a66910fd4 to your computer and use it in GitHub Desktop.
My git configuration
[alias]
stash-unapply = !git stash show -p | git apply -R
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ai) %C(bold blue)<%an>%Creset' --abbrev-commit
co = checkout
br = branch
ci = commit
st = status
unstage = reset HEAD
last = log -1 HEAD
oldest-ancestor = !bash -c 'diff --old-line-format= --new-line-format= <(git rev-list --first-parent \"master\") <(git rev-list --first-parent \"HEAD\") | head -1' -
log-merge = "!f() { git log --stat \"$1^..$1\"; }; f"
find-merge = "!sh -c 'commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2'"
show-merge = "!sh -c 'merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge'"
ta = "!f() { git tag -a \"$1\" -m \"$1\" \"${2:-HEAD}\"; }; f"
show-description = !git config \"branch.$(git branch --show-current).description\"
dlog = -c diff.external=difft log --ext-diff
dshow = -c diff.external=difft show --ext-diff
ddiff = -c diff.external=difft diff
[rerere]
enabled = true
autoupdate = true
[pull]
rebase = true
[merge]
tool = code
conflictstyle = diff3
[mergetool "code"]
cmd = code --wait --merge $REMOTE $LOCAL $BASE $MERGED
[diff]
colorMoved = default
tool = difftastic
[difftool]
prompt = false
[difftool "difftastic"]
cmd = difft "$MERGED" "$LOCAL" "abcdef1" "100644" "$REMOTE" "abcdef2" "100644"
[pager]
difftool = true
[init]
defaultBranch = main
[rebase]
autosquash = true
[push]
followTags = true
autoSetupRemote = true
[fetch]
prune = true
[branch]
sort = -committerdate
[tag]
sort = -creatordate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment