Git aliases
9 September 2022
Maybe you've seen git log --oneline
, but it was always missing a certain something... and that of course is the date!
The output format and date options can be found on the official git-log docs. There are options to include the author (and other information), but I've found that for any one branch, the author very rarely changes.
bash
# ~/.gitconfig
[alias]
lo = log --oneline --pretty=format:'%C(auto)%h%d %s %C(cyan)- %ad' --date=format:'%b %-e, %Y.'
l = log -n 8 --oneline --pretty=format:'%C(auto)%h%d %s %C(cyan)- %ad' --date=format:'%b %-e, %Y.'
tree = log --graph --pretty=format:'%C(auto)%h%d %s %C(cyan)- %ad' --date=format:'%b %-e, %Y.'
tr = log -n 8 --graph --pretty=format:'%C(auto)%h%d %s %C(cyan)- %ad' --date=format:'%b %-e, %Y.'
# --pretty=format: replicate --oneline styling, and additionally include date
# oneline: shorthand for "--pretty=oneline --abbrev-commit"
# graph: draw an ASCII graph
lo
: short version oflog
l
: short version oflo
tree
: graph version oflog
tr
: short version oftree
Here are some other personal aliases.
bash
[alias]
st = status --short --branch
# short: show short format
# branch: show branch and tracking info
co = checkout
cl = clone
br = branch
ci = commit
wt = worktree