Skip to content

Instantly share code, notes, and snippets.

View Parent5446's full-sized avatar

Tyler Romeo Parent5446

View GitHub Profile
@Parent5446
Parent5446 / pre-commit
Last active April 18, 2017 03:34 — forked from DmZ/pre-commit
Adjusted regex to make more accurate
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

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: