Skip to content

Instantly share code, notes, and snippets.

@ahacke
Last active January 16, 2024 21:08
Show Gist options
  • Save ahacke/a324533db62c3916e8ded52ddd48f58c to your computer and use it in GitHub Desktop.
Save ahacke/a324533db62c3916e8ded52ddd48f58c to your computer and use it in GitHub Desktop.
gitconfig-file
# ideas from: https://gist.github.com/tdd/470582
[user]
name = <github-username or full name>
email = <github-username>@users.noreply.github.com
[core]
autocrlf = input
# VSCode
editor = code --wait
# Don't consider trailing space change as a cause for merge conflicts
whitespace = -trailing-spac
[pull]
rebase = true
[push]
autoSetupRemote = true
[alias]
# List available aliases
aliases = !git config --get-regexp alias | sed -re 's/alias\\.(\\S*)\\s(.*)$/\\1 = \\2/g'
# Add this to your `.gitconfig` to easily get rid of branches that have been (squash-) merged via git gone
gone = "!f() { git fetch --all --prune; git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D; }; f"
# Command shortcuts
ci = commit
co = checkout
st = status
# Display tree-like log, because default log is a pain…
lg = log --graph --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'
# List local commits that were not pushed to remote repository
review-local = "!git lg @{push}.."
# Edit last commit message
reword = commit --amend
# Undo last commit but keep changed files in stage
uncommit = reset --soft HEAD~1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment