Part of my personal shortcuts for the usual pull-request-based workflow.
Given you have an "upstream" repository you need to work on:
- Fork it
- Clone your fork locally (repo "origin")
- Add remote "upstream" with
git remote add upstream $URL(not required but it's easier for you to sync later)
OK, you're all set up. Now you need hub.
Then, on your daily work, you'll have to fix issues (new features, bugs, whatever it's generally an issue) open on upstream repository.
# synchronize masters, always better git checkout master git pull upstream master git push origin master # create your branch for the issue 42 git checkout -b fix-universe-42 # I like adding issue number in branch name, for memory while not-fixed; do work && git add -p && git commit done # now git-pr in action: push, and replaces the issue with a pull-request on upstream repo :) git-pr 42 upstreamGitHubUsername:branch
You don't require admin permissions, but you may require commit permissions. I did not try this on a repos I did not have permissions to push in.
Setting upstream repository
hub notation is quite unusual: it's "
branch", or "
branch" whenever the repository has different name on your
origin and your
upstream. Working on many different repositories, I felt lazy about typing the target each time, so I used
git config --local pr.upstream to store the target.
Let's say you forked
universe/earth and are working on issue #42. You can either:
# append "universe:master" each time you'll use git-pr git-pr 42 universe:master
# remember it once for all git-pr-config universe:master # Note: this simply adds those lines to your .git/config: #[pr] # upstream = universe:master # simplier for next calls git-pr 42