Skip to content

Instantly share code, notes, and snippets.

@jondlm
Last active October 18, 2016 15:52
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 jondlm/30bc69b87399b5d696f528b474c05932 to your computer and use it in GitHub Desktop.
Save jondlm/30bc69b87399b5d696f528b474c05932 to your computer and use it in GitHub Desktop.
Some useful git stuff

Git Stuff

A collection of git utilities and scripts I've found useful at least once.

Aliases

List the 30 most recent branches you've committed to.

brr = for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)'

Switch to one of your recent branches. Replace fzf with your favorite fuzzy finder.

rc = !git checkout $(git brr | fzf)

Bash

List all files created differently in other branches, by branch.

git branch \
  | sed 's/^[ \*]\+//g' \
  | tee /dev/tty \
  | xargs -n 1 git --no-pager diff --diff-filter=A --summary \
  | sed 's/create mode [0-9]\+//g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment