Skip to content

Instantly share code, notes, and snippets.

@cas--
Created April 19, 2024 15:00
Show Gist options
  • Save cas--/a4a92b9c0045a526209b3ea2aa800115 to your computer and use it in GitHub Desktop.
Save cas--/a4a92b9c0045a526209b3ea2aa800115 to your computer and use it in GitHub Desktop.
Common Git Aliases
[alias]
b = branch
br = branch
ci = commit
ci-aa = commit --am -a
ci-f = "!git commit --fixup=$1 $2 #"
ci-s = "!git commit --squash=$1 #"
co = checkout
cob = checkout -b
chp = cherry-pick
# log: <sha> <commit msg> <nick> <dd.mm>
hist = log --pretty=format:'%C(auto)%h %<(47,trunc)%s %C(dim italic cyan)%>(7,trunc)%aN %C(green)%cd' --date=format:'%e·%b·%y'
# duplicate of hist with only 15 entries
hi = log --pretty=format:'%C(auto)%h %<(47,trunc)%s %C(dim italic cyan)%>(7,trunc)%aN %C(green)%cd' --date=format:'%e·%b·%y' -15
# use hist alias show only 5, (note: does not autocomplete)
h = !git hist -5
rb = rebase
rb-c = rebase --continue
rb-a = rebase --abort
rb-i = rebase --interactive --autosquash
sh = show --no-prefix
di = diff --no-prefix
st = status
s = status -sb
aliases = config --get-regexp ^alias\\.
g = grep
conflicts = diff --name-only --diff-filter=U
trailer-append = "!git commit --amend -m \"$(echo \"$(git log --format=%B -n1)\" | git interpret-trailers --trim-empty)\""
showtool = "!showci () { rev=${1:-HEAD}; git difftool $rev~1 $rev; }; showci $1"
pushf = push --force-with-lease --force-if-includes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment