Skip to content

Instantly share code, notes, and snippets.

@yannmh
Forked from LeoCavaille/.gitconfig
Last active August 29, 2015 14:23
Show Gist options
  • Save yannmh/4ac0d7b94c0f2bc752cb to your computer and use it in GitHub Desktop.
Save yannmh/4ac0d7b94c0f2bc752cb to your computer and use it in GitHub Desktop.
[alias]
checkoutpr = "!f() { git fetch origin refs/pull/$1/head:pr/$1; git checkout pr/$1; } ; f"
checkoutcontrib = "!f() { git checkout master && git pull && git remote add $1 git@github.com:$1/dd-agent && git fetch $1 $2 && git checkout -b $3 $1/$2 && git rebase master } ; f"
# First of course clear your staging area and stash your mess
# Forked and PR'd from contributor:mysuperfeature
git checkoutcontrib contributor mysuperfeature leo/rebasedsuperfeaturebranch
# OK it's rebased I can do my mods
git rebase -i master
# Include a message in the commit if you're commiting someone else's work
# For example:
# [leo@datadoghq.com] rebased current work to get new feature and minor
# cosmetic changes
# Or add more work
git commit -m "Some work"
git push origin leo/rebasedsuperfeaturebranch
# Create a new PR with this branch
# Close the other one
# Don't forget to thank the contributor!
# If you want just to checkout one PR's code to play with it locally
# Get the PR number, return in a clean state and run for PR 23432
git checkoutpr 23432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment