Skip to content

Instantly share code, notes, and snippets.

@n18l
Created April 5, 2019 22:45
Show Gist options
  • Save n18l/198316ad57227ade3e4507e78122a811 to your computer and use it in GitHub Desktop.
Save n18l/198316ad57227ade3e4507e78122a811 to your computer and use it in GitHub Desktop.
Nick's git Aliases
[alias]
st = status
graph = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
# I use tug and weld to simplify my branch management. I often want to
# keep a branch distinct even when it could be fast-forwarded, so weld
# saves me a second there. I use tug to update a branch without
# automatically initiating a merge when I don't mean to.
tug = pull --ff-only
weld = merge --no-ff
# The snub commands are useful for projects where you end up with build
# files or directories that you don't want to track changes on but end up
# needing to commit now and then. They'll let you quickly hide and reveal
# such files until you need to commit them.
snub = update-index --assume-unchanged # snub a single file
snub-dir = "!f() { cd \"$1\" && git ls-files -z | xargs -0 git snub && cd -; }; f" # snub an entire directory
unsnub = update-index --no-assume-unchanged # unsnub a single file
unsnub-dir = "!f() { cd \"$1\" && git ls-files -z | xargs -0 git unsnub && cd -; }; f" # unsnub a single directory
unsnub-ch = update-index --really-refresh # unsnub changed files
snubbed = ! git ls-files -v | grep '^[a-z]' | cut -c3- # list all snubbed files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment