Skip to content

Instantly share code, notes, and snippets.

@aalhour
Last active April 18, 2024 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aalhour/fa58553d6d48d8244a06ee6f983f7dad to your computer and use it in GitHub Desktop.
Save aalhour/fa58553d6d48d8244a06ee6f983f7dad to your computer and use it in GitHub Desktop.
~/.gitconfig
[gpg]
format = ssh
[commit]
gpgsign = true
[push]
default = simple
autoSetupRemote = true
[alias]
# one-line log
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
a = add
ap = add -p
c = commit --verbose
ca = commit -a --verbose
cm = commit -m
cam = commit -a -m
m = commit --amend --verbose
d = diff
ds = diff --stat
dc = diff --cached
s = status -s
co = checkout
cob = checkout -b
# list branches sorted by last modified
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
# list aliases
la = "!git config -l | grep alias | cut -c 7-"
# squash the entire tree into a single commit. WARNING: IT WILL MAKE FEATURE BRANCHES BROKEN
squash-whole-tree = "!f(){ git reset $(git commit-tree HEAD^{tree} \"$@\");};f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment