Skip to content

Instantly share code, notes, and snippets.

@jlafon
Created March 26, 2014 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlafon/9782816 to your computer and use it in GitHub Desktop.
Save jlafon/9782816 to your computer and use it in GitHub Desktop.
My git aliases
[alias]
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# View the current working tree status using the short format
s = status -s
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
# Pull in remote changes for the current repository and all its submodules
p = !"git pull; git submodule foreach git pull origin master"
# Clone a repository including all submodules
c = clone --recursive
# Commit all changes
ca = !git add -A && git commit -av
# Switch to a branch, creating it if necessary
go = checkout -B
# Show verbose output about tags, branches or remotes
tags = tag -l
# Show all branches
branches = branch -a
# Show all remotes
remotes = remote -v
# Be careful with this one. Use it only when you haven't pushed your last commit to a remote.
undo = reset --soft HEAD~1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment