MIT 6.S194 | Open Source Software Project Lab  

Pull Requests and Rebasing

Figure 1. All your (re)base are belong to us.

Disclaimer: This exercise page functions as a compliment to what we'll be doing together in class. It won't work stand-alone

Fork and Clone the Hackathon Repo

First, split up in pairs again for error redundancy :).
  1. Go to http://github.com/software-development/hackathon. Fork it to your own account (e.g., eob/hackathon)
  2. Now clone your copy of the repository down to your own computer

On Board: What team structure did we just create?

Create a new branch for your change

  1. Create a branch for your change. Name it appropriately
  2. Add your pizza request
  3. Push your changes up to your github repo

On Projector: Explore some changes on Github.

Create a pull request

We'll look at some of these in Github and merge them in.

What about the other pull requests?

They're out of date now that we've begin changing the official repository.

First, add the official repository as a read-only remote.

 git remote add official git://github.com/software-development/hackathon.git

Next, bring your local master up to date.

git checkout master
git pull official master

And while you're at it, might as will push those changes up to your github Repo

git push origin master

Now, you can rebase your feature branch with the new official master

git checkout eob-pizza-request
git rebase master

You'll be prompted to add and resolve any conflicts.

When you're done, try to push that up to your request branch

git push origin eob-pizza-request

It fails: why?

  • Discuss: Rebasing to keep in track before you publish your change

Let's delete that remote branch and pretend it never existed.

This is the unfortunately awkward command to delete a remote branch:

git push origin :eob-pizza-request

Now try pushing your feature branch up again:

git push origin eob-pizza-request

Now try that pull request again.

  • Discuss: But what about once you've issued the pull request? How do update without deleting?