Skip to content

Instantly share code, notes, and snippets.

@jondlm jondlm/git-stuff.md
Last active Oct 18, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.