Skip to Content
Technical Articles
Author's profile photo Jason Xia

Cookbook for working with pull request in Github

About pull requests

Pull requests let you invite others to review changes you’ve pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.

More details about pull requests can be found from the GitHub Help document.

Make changes to topic branch

Create a topic branch in a command line console.

Git checkout -b test_for_pull_request

Make some changes to some files you want.

Add one or more files to staging (index).

git add <filename>

or

git add *

 

Commit changes to head (but not yet to the remote repository). Then push changes to the master branch of remote repository.

git commit -m "Commit message"
push -u origin test_for_pull_request

Create pull request

On the home page of the repository, create the “New pull request”.

The “Open a pull request” view is displayed. You can specify the base repository, head repository, base branch and compare branch. The base branch is the branch you’d like to merge your changes into. The compare branch is the topic branch which contains your changes.

By default, pull requests are based on the parent repository’s default branch. If the default values are not correct, you can change both the repository and the branch with the drop-down lists.

Type a title and description for your pull request. Click the “Create pull request” button. The pull request is created.

The reviewers are assigned automatically.

At this moment, Merge pull request is not possible before code owner review is finished.

After your pull request has been reviewed and approved, it can be merged into the repository by clicking “Merge pull request”.

During code review, you can add comments by clicking “Comment” button.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.