Skip to content

Instantly share code, notes, and snippets.

@b-dur
Last active July 17, 2026 07:32
Show Gist options
  • Select an option

  • Save b-dur/2d58b0efa23a26a556a9400378da87ef to your computer and use it in GitHub Desktop.

Select an option

Save b-dur/2d58b0efa23a26a556a9400378da87ef to your computer and use it in GitHub Desktop.
My preferred gitconfig setup
[user]
email = b-dur@b-dur.dk
name = Bardur Sigmundarson
[branch]
autosetuprebase = always
[core]
editor = vim
[push]
default = current
autoSetupRemote = true
[rebase]
autoStash = true
autosquash = true
[alias]
pf = push --force-with-lease
pushf = push --force-with-lease
rebase-on = !git fetch -p && git rebase --autostash
update = pull --autostash
fixup = commit --fixup
logs = log --oneline
rebase-fix = rebase -i --autostash --autosquash
prune-branches = "!f() { git branch --merged | grep -v '*' | xargs git branch -d; git for-each-ref --format='%(refname:short) %(committerdate:iso)' refs/heads | awk '$2 < \"'$(date -d '30 days ago' -Iseconds)'\" {print $1}' | xargs -r git branch -D; }; f"
up = "!f() { git rebase-on $(git origin); git pf; }; f"
nb = "!f() { git fetch -p; git checkout -b \"$1\" $(git origin); }; f"
new = nb
origin = "!f() { git branch -rl '*/HEAD' | cut -d ' ' -f 5-; }; f"
a = c --ammend
c = commit
ca = commit --amend
[fetch]
prune = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment