Creating a Pull Request in Git

Table of contents:

Creating a Pull Request in Git
Creating a Pull Request in Git

Git is a version control system, a tool for collaborative software development. Any team software development needs a convenient tool for tracking the work done and the changes made, fixing those responsible for the correction, creating the possibility of coordinating developments or rolling back in case of errors. Git is essential because:

  • Keeps the development history.
  • Controls access rights to shared code.
  • Provides version control of the software product.
Git system
Git system

Git was developed by Linus Torvalds to make it easy to create a Linux kernel. There are several ways to manage a project through Git: you can use web services such as GitHub or download a graphical Git client. There are several free clients for any operating system, such as SmartGit. Since Git core is a command-line package, it is also convenient to use it directly from this location. The functionality will be the same both in working with the web service and ingraphic client. Beginners are advised to delve into the study of the console version - this will help you understand the commands and internal structure much faster.

Desktop client
Desktop client

Next, we will analyze in detail one of the Git commands - Pull Request.

Pull request is a proposal to change the repository. This mechanism is used in general work on software products. Allows you to coordinate the activities of developers and avoid confusion. Anyone who wants to modify or modify an existing project must take the following steps.

Git: how to make a pull request

  • Fork command - create a local copy of the working repository.
  • Finish or modify your copy.
  • Pull request command - propose changes in the code to the owner of the repository.
  • Merge command - with the help of it the owner of the repository approves changes.
  • Git pull request can be created in two ways. The first is through the console, the second is using the capabilities of the web service where your repository is located.

Pull Request is a feature exclusively in the GitHub Git client that relies on the request pull console command. If you need to make a pull request through the console, you need a web API application, such as hub. You can make a pull request for GitHub from a desktop application if it supports the GitHub API.

Git web service: create pull request

To propose changes to the project to the owner of the repository, you must:

  • Go to the branch containing the originalfile.
  • Press New pull request.
  • If changes have been made, the Comparing changes window will open.
  • In it you can specify the path, from which branch of which repository and where to send changes.
  • Click Create pull request.
  • It is advisable to clarify in the appropriate fields what changes have been made.
  • Now the owner of the repository will see a change notification in the Pull requests tab.

The owner, in turn, can execute a "merge pull request" on the Git repository. This will implement the changes suggested by the upstream developer.

Development branches
Development branches

It's also pretty handy to use the Git console client. A Pull Request is made through a web service, if the GitHub API is not installed, the algorithm for making changes to the remote repository will be shown below. To make changes to the remote repository through the console after correcting the code, enter the following commands:

  • Command git add NewFile.cxx - add a new file to the local repository.
  • Command git commit -a -m commit message - create a commit, specify the changes in the project in the commit message.
  • Git push origin command - making changes to the remote repository (you need to confirm your login and password).
  • Next, you also need to use the web version of Git that hosts your remote repository and create a pull request using the guide above.


In Git Merge, a pull request is a command to merge a development branchfeature with the main branch (master). There are two merge patterns:

  • True fusion. Occurs when several changes need to be made to the upstream development branch. That is, a new commit is created in the master branch, which refers to several of the same attributes from feature.
  • Rewind. If the commit history turned out without branches, then the master pointer is rewound forward, and is set to the one pointed to by the feature branch.
Development patterns
Development patterns

Working with Git

When working with Git, it is always important to remember that there are two repositories - local and remote. The local one is created on the developer's machine after the clone command, for example, if the developer wants to join the project. That is, you can work with the version control system without an Internet connection, only the pull and push commands will require a connection to a remote repository. Of course, it is impossible to do "pull request" locally in Git.

Pull performs the merge if the remote and local histories differ.

The Push operation sends all changes that are not in the remote repository. If there are new commits in the remote repository, the operation will fail.

That is, locally, the developer has a master branch, which is the last change, and the origin/master branch is the state of the remote repository after the last Pull or Push operation.

Popular topic

Editor's choice

  • What is a proxy server and what is it for?
    What is a proxy server and what is it for?

    The word "proxy" has ever been heard by any of us, but not everyone knows what a proxy server is and what its purpose is

  • Google Chrome not working. What to do?
    Google Chrome not working. What to do?

    So why doesn't Chrome launch when we click on its desktop icon? Google Chrome not working for several reasons

  • Recovery console. Main benefits of using
    Recovery console. Main benefits of using

    Computers are quite technically complex devices. In this regard, many users from time to time encounter failures in the operation of the operating system and other programs. In most cases, you can fix problems in a matter of minutes, especially if the computer technician has the necessary skills. If a critical failure occurs, it is recommended to use the recovery console

  • What is the cluster size?
    What is the cluster size?

    The space of any storage medium (hard drive or flash drive) is not a whole piece, but a system of memory cells called clusters

  • What is defragmentation and why is it needed?
    What is defragmentation and why is it needed?

    Modern users are often spoiled by powerful computers and inexpensive components to such an extent that they do not even know the basic concepts. That is why they often find themselves in a situation where the car begins to shamelessly “slow down” and respond with extreme reluctance to any commands. As a rule, “evil viruses” that have entered the computer are blamed for everything, but sometimes the reality turns out to be much more prosaic