Skip to content

Instantly share code, notes, and snippets.

@hmRemi
Forked from anbergem/.gitconfig
Last active September 18, 2025 08:51
Show Gist options
  • Select an option

  • Save hmRemi/08541005229e0c540d6bd4a934e35251 to your computer and use it in GitHub Desktop.

Select an option

Save hmRemi/08541005229e0c540d6bd4a934e35251 to your computer and use it in GitHub Desktop.
Preferred git config
[filter "lfs"]
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
[user]
name = Andreas Bergem
email = ...
[init]
defaultBranch = main
[credential]
helper = manager
[core]
editor = Notepad
autocrlf = true
[alias]
# Pretty logging
lg1-this = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
lg1 = !"git lg1-this --all"
lg2-this = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg2 = !"git lg2-this --all"
# Go-to log
lg = !"git lg1"
lg-this = !"git lg1-this"
lgt = !"git lg1-this"
gg = status --short
push-u = push -u origin HEAD
cu = "!f() { git checkout -B ${1} origin/${1}; }; f" # Checkout and update to origin of branch
amend = commit --amend --no-edit
# Get a pretty list of the most recent branches, in descending order.
branch-list = for-each-ref --sort=-committerdate refs/heads/ --format='%(HEAD) (%(color:green)%(committerdate:relative)%(color:reset)) %(color:yellow)%(refname:short)%(color:reset) - %(authorname) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject)'
fwl = push --force-with-lease
pf = push --force
[merge]
ff = no # Auto --no-ff when merging
[pull]
ff = yes # Allow ff when pulling
[fetch]
prune = true # Deletes remote branches when fetching
recurseSubmodules = no # Don't automatically fetch all submodules
[diff]
ignoreSubmodules = dirty # When using git diff, ignore diffs in submodules
[rebase]
autosquash = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment