Protected Branch Workflow

Overview

This document describes a workflow for contributing to projects that have a protected master branch. The contribution process involves making an edit, creating a new branch, creating a pull request, merging the pull request, and then deleting the branch you created. Follow the steps below to make a contribution.

Step By Step

Make Your Edits

  1. Browse the project and use the pencil icon to edit a file like you normally would.
  2. On the edit page, make whatever changes you would like.
  3. At the bottom of the screen, you will be unable to commit your changes to the master branch since it is protected. Instead, type in a short descriptive name to create a new branch. Like this:image
  4. Click Commit Changes to save your work.
  5. If you have multiple changes to make at the same time, you can put them all on the same branch. Just make sure that you are browsing the branch you just made by verifying the branch name in the branch drop down. For example, 24%20AM
  6. Then you may click the pencil icon like normal to make another edit and you’ll see in the Commit Changes box that your in progress branch is already selected, like this:
  7. Once you are finished with your changes, create a Pull Request.

Create a Pull Request

Once your changes have been made you can create a pull request to merge them into the master branch. Follow these steps.

  1. Under the name of you project, click the “Pull Requests” button that has a number next to it.image

  2. Now click the green “New Pull Request” button in the upper right.image

  3. In the left hand box make sure that it says “base: master”. In the right hand box, select the branch you just created. As an example:

  4. Give your pull request a title in the title box.

  5. Fill out the description box under “Write” to provide others a description of the changes you are suggesting.

  6. Click the green “Create Pull Request” button.image

Merge the Pull Request

In this step, usually someone else on the project should be the person to merge the pull request into the master branch. This may include some discussion or changes to your initial edits, which can be made directly on the new branch you created.

When the pull request is approved, it should be merged by clicking the green “Merge Pull Request” button, image

The final step is to delete the branch that you initially made for the edits. Whoever merged the pull request should have the option to do this after the branch has been merged. For example,

Click Yes on the warning dialog that pops up. Note that because the branch has already been merged into master, there is no data loss in this operation.