Skip to main content
  1. Learn
  2. Software Development
  3. Guides
  4. Git tutorial
  5. How to use Git
  6. How to use pull requests in Git
GuidesSoftware DevelopmentBacklog

Project and code management together.

How to use pull requests in Git

In this tutorial, you’ve learned how to use Git with Windows, Mac, or Command Line, worked with branching and tagging, and practiced managing your commit history. Now we can jump into pull requests.

To demonstrate how to use pull requests, we first need to create, modify, and push a new branch.

If you missed our introduction to pull requests, you can revisit it here.

To start, create the following JS file in the repository.

// sort.js
  var number = [19, 3, 81, 1, 24, 21];

Then push it to a remote branch.

Learn how to push to a remote repository on Windows, Mac, or Command Line

Next, create a branch called “add-sort-func” to sort an array.

$ git checkout -b add-sort-func

Learn how to create a branch.

And modify the file as follows.

// sort.js
  var sortNumber = function (number) {
    number.sort(function (a, b) {
      if (a == b) {
        return 0;
      return a < b ? -1 : 1;

  var number = [19, 3, 81, 1, 24, 21];

Then commit the changes.

$ git add sort.js
$ git commit -m "<commit_message>"

Finally, use the git push command to push the modified branch to a remote branch.

$ git push origin add-sort-func

Now you’re ready to create a pull request.

In case you missed our intro, we’re using Backlog in this tutorial, but especially in this section where we highlight pull requests. You can start a free trial of Backlog now.

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life