Skip to content

Instantly share code, notes, and snippets.

@bskinn
Last active March 3, 2024 00:02
Show Gist options
  • Save bskinn/fdeff46d22340f6ad830ecc32afecd67 to your computer and use it in GitHub Desktop.
Save bskinn/fdeff46d22340f6ad830ecc32afecd67 to your computer and use it in GitHub Desktop.
Various git aliases
# [alias] has been improved to where you don't need explicit sh calls.
# And, as long as you don't need argument processing, you can just
# alias to whatever you would type after 'git'.
[alias]
# Pretty-printed tree view of the commit history
# Can't remember where I found the incantation
logtree = log --graph --all --oneline --decorate=full
# Same as logtree, but adds timestamps for each commit
logtreed = log --graph --all --oneline --decorate=full --pretty=format:'%C(auto)%h%d (%cI) %s'
# Show the timestamps for all of the commits where a file was modified
# git recipe from https://stackoverflow.com/a/2390382/4376000
# bash-function alias syntax from https://www.atlassian.com/blog/git/advanced-git-aliases
filedates = "!f() { git log --follow --format='%h %ad %s' --date default -- $1; }; f"
# Mimics GitHub's `/compare/`. Pass it a double- or triple-dot spec between two
# refs of interest.
cmp = "!f() { git log $1 --graph --oneline --decorate=full --boundary; }; f"
# Shortcut for the incantation needed to consolidate fixup commits
fixup = rebase -i --autosquash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment