Skip to content

Instantly share code, notes, and snippets.

@immutef
Created October 25, 2010 19:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save immutef/645524 to your computer and use it in GitHub Desktop.
Save immutef/645524 to your computer and use it in GitHub Desktop.
HowTo: clean GitHub pull requests for Symfony2
  1. Fork Fabiens repository: http://github.com/fabpot/symfony.git

  2. Clone your fork and install/update vendors (I use my personal fork for now):

    git clone git@github.com:pminnieur/symfony.git symfony

    cd symfony && sh install_vendors.sh && sh update_vendors.sh

    phpunit

  3. Integrate Fabiens repository into your local clone:

    git remote add fabpot git://github.com/fabpot/symfony.git

    git config branch.master.remote fabpot

    git config branch.master.merge master

  4. To keep your master up-to-date and synchronized with Fabiens:

    git fetch fabpot && git rebase fabpot/master master

  5. Create a new branch for everything you want to change:

    git checkout -b BRANCH_NAME fabpot/master

    NOTICE: steps 5-8 are the essence for successful pull request.

  6. Do your stuff, check it, commit it, remerge with master:

    git status

    git commit -m "did some fancy things on a hard topic"

    git pull --rebase

  7. Push everything to your origin:

    git push origin BRANCH_NAME

  8. On GitHub, create a pull request. From fabpot:master to YOUR_NAME:BRANCH_NAME. That's it.

    NOTICE: If you commit and pull more into this branch, they'll automatically be added to this pull requests until it is closed. This is indeed very cool for follow up commits (like fixing a typo, or adding some more functionality), but it really sucks if you're working on another topic. Thus, create and switch branches for everything. Really everything. EVERYTHING! Otherwise Fabien cannot differentiate what you originally wanted him to pull into his master.

  9. If the pull request is closed and your changes are merged into Fabiens master branch, and you're done with that specific topic, you can cleanup your branch (delete it):

    git checkout master

    git pull --rebase

    git branch -d BRANCH_NAME

    git push origin :BRANCH_NAME

  10. If you want to work on another branch (w/o deleting the others):

    git checkout OTHER_BRANCH_NAME

Many kudos to the Doctrine guys, their "Contributors Workflow" really helped me to figure this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment