Skip to content

Instantly share code, notes, and snippets.

@lmiceli
Last active March 10, 2017 11:17
Show Gist options
  • Select an option

  • Save lmiceli/d15f90816a0e430a800c733e770ae05d to your computer and use it in GitHub Desktop.

Select an option

Save lmiceli/d15f90816a0e430a800c733e770ae05d to your computer and use it in GitHub Desktop.
[alias]
ll = log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
# one-line log
l = log --pretty=format:"%C(#b6b649)%h\\ %ad%C(#f5236c)%d\\ %Creset%s%C(#0383f5)\\ [%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-"
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
# Delete the remote version of the current branch
unpublish = "!git push origin :$(git branch-name)"
# Working with files
#
# Unstage any files that have been added to the staging area
unstage = reset HEAD
# Show changes that have been staged
diffc = diff --cached
# Mark a file as "assume unchanged", which means that Git will treat it
# as though there are no changes to it even if there are. Useful for
# temporary changes to tracked files
assume = update-index --assume-unchanged
# Reverse the above
unassume = update-index --no-assume-unchanged
# Show the files that are currently assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment