Tuesday, January 22, 2013

Updating an existing Github pull request

Akka uses single commits for its pull requests, so that changes can be easily understood and rolled back. Pull requests are contained in their own branch. Here's how I updated my single-commit pull request with some changes and resubmitted it.

  1. Rebase the last two commits interactively.
    git rebase -i HEAD~2
  2. When asked, squash the latest commit into the previous one.
  3. Replace the existing upstream branch with the updated one. Use + to signify that the updated branch isn't based on the old one. (Often origin is used instead of upstream.)

    git push upstream +wip-2798-ensuring-rich

Thursday, January 17, 2013

Moving an existing repo to Github

Assuming you already have code in a local repository…

  1. Got to https://github.com/new and create a new repository. Remember to create it without a .gitignore or README file so as to avoid needing a merge.
  2. In your local repo run a command like:
    git remote add origin git@github.com:richdougherty/kitteh-feeder.git
  3. Then run:
    git push -u origin master

Via Stack Overflow.