Skip to content

Instantly share code, notes, and snippets.

@montyanderson
Created November 19, 2019 20:19
Show Gist options
  • Save montyanderson/b8fc94c5f0c2149029875ba1b08c803f to your computer and use it in GitHub Desktop.
Save montyanderson/b8fc94c5f0c2149029875ba1b08c803f to your computer and use it in GitHub Desktop.
[alias]
# Checkout a pull request branch on an upstream project. It
# handles PRs that get rebased as well.
#
# git pr 3
pr = "!f() { git checkout master; git branch -D pr/$1 || true; git fetch origin refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f"
# Pull a rebasing branch on a fork. Useful for viewing someones
# rebasing feature branch from a clone of their fork.
pbr = "!f() { b=$(git rev-parse --abbrev-ref HEAD); git fetch origin $b && git reset --hard origin/$b; }; f"
# Really really clean checkout. Just shy of a completely fresh
# clone.
squeaky-clean = "!f() { git reset --hard && git clean -dxff; git submodule foreach git squeaky-clean; git submodule update --init --recursive; }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment