Skip to content

Instantly share code, notes, and snippets.

View tfhartmann's full-sized avatar
:octocat:
Being Awesome

Alaric Hartmann tfhartmann

:octocat:
Being Awesome
View GitHub Profile
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@charity
charity / init.sh
Created May 18, 2016 20:19
terraform environment init.sh
#!/bin/bash
# Usage: ./init.sh once to initialize remote storage for this environment.
# Subsequent tf actions in this environment don't require re-initialization,
# unless you have completely cleared your .terraform cache.
#
# terraform plan -var-file=./production.tfvars
# terraform apply -var-file=./production.tfvars
tf_env="production"
[alias]
pr = "!f() { git fetch origin pull/$1/head:sethvargo/pr-$1 && git checkout sethvargo/pr-$1; }; f"
unreleased = "!f() { git fetch --tags && git diff $(git tag | tail -n 1); }; f"
up = "!f() { git fetch --all; git pull origin HEAD; for upstream in $(git remote); do git remote prune "${upstream}"; done }; f"
graph = "!f() { git log --oneline --abbrev-commit --graph --decorate; }; f"
undo = !git reset HEAD~1 --mixed
amend = !git commit --amend --no-edit
top = !git log --format=format:%an | sort | uniq -c | sort -r | head -n 20
x = "!f() { gitx; }; f"