create-pull-request-and-update-status.jpg

Create Pull Request and Update Status on GitHub (In 5 steps)

Apr 12th, 2022 | Varshish Bhanushali

GitHub is an open-source platform where you share and contribute to projects like Magenta, Photon, Rebound, or Mailpie.

A pull request is a method of submitting contributions to an open-source development project. Open source projects are hosting public repositories where you benefit the host by additions. The wider developer community can take part in the project. Here, the host has the charge to accept requests from the community and enable them to contribute.

This article guides you to the creation of a pull request to a Git repository.



How can you create pull request?

  1. Create a copy of the repository:
  2. A repository is the major folder of the project. It contains your project files like documentation, revision histories, and more. It can have many contributors and can either be public or private.

  3. Fork the repository:
  4. Navigate to the GitHub URL of the open-source project you contribute.

    GitHub repository URLs reference the username associated with the owner of the repository and its name.

    Like, [https://github.com/username/repository]

    Or, you can search for the project using the GitHub search bar. On the main page of the repository, tap on the ‘Fork’ button in the top right corner. Once you complete it, you receive a notification.

    Then, you will see the same link which you have seen through the first process.

  5. Clone the Repository:
  6. To do it, first, open up a terminal window.

    Now, enter the command [git clone] along with the URL of your fork of the repository.

    The URL will be, [https:// github.com/username/repository.git]

    Now, get ready to clone the repository by typing the [git clone] command. It will be with the repository URL in a terminal window. Like, [$ git clone https:// github.com/username/repository.git]

  7. Create a new branch:
  8. Whenever you contribute to a project, programmers might have different ideas. For that reason, the creation of your branch is important.

    The main branch is the name of the primary branch. The best practice is to make it available for other contributors to use.

    Also, create your branch under names like [backend-hook-migration] instead of [my-branch].



How can you create a branch?

  • Change the branches and the directory, and use the same name.
  • Create your new branch with the [git branch] command.
  • To make sure you are working on the branch, use the [git checkout] command.
  • To condense the above two commands and switch to a new branch, you can follow the by command
  • To switch back to the main branch, you can use the [checkout] command with the name of the main branch.
  • The command will enable you to switch between more branches.
  • Now, you are open to modifying old files or adding new files.


How can you make the final changes?

  • Add some content to the new file.
  • Create your new branch with the [git branch] command.
  • Now, save and close the file.
  • Once you complete the file, move to the local repository by the [git add] command.
  • If you want to add all changes including those type [git add -A] or [git add -all] for all new files.
  • To record the changes to the repository, type the [git commit] command.

The commit message helps the other contributors to understand the change you made. It also helps you to record all changes you made from first to last.

If you have a short message, type [-m] flag and this message, [$ git commit -m “Added a new haiku in]

To save and exit the commit message text file, verify what git will commit to and use this command. [ $ git status]

Now, you can use the command [git push] to push the changes to the current branch of your forked repository.



How to update the local repository:

To keep your local copy of the codebase updated, you’ll need to sync changes.

First, configure the fork and then sync the fork.


Create pull request:

Navigate to the forked repository. And press the New Pull Request button. Select the appropriate repository from the branch.

For example, the main branch of the original repository on the left side and the new branch of the forked repository on the right side, you see a screen saying to merge both branches if there is no competing code. Then, add a title and a comment to the fields and press ‘Create pull request.’

Now, the maintainers of the original repository decide about the acceptance of your request.For this reason, you should create your request with all details. They may ask for a revision of your code prior to accepting the pull request.

They may ask you to edit or revise the code before they accept.


Update the status:

  • Open a command window.
  • Go to the directory containing the GitHub repository.
  • Tell Git to check out the relevant branch.
  • Run Git status to check the status of your local files.
  • Run the command to pull down the recent changes from your branch to your local repository.
  • Update the files that you need to change.
  • Run git status to check the status of your local files.
  • Run the commands to commit the updated files to your local Git repository.
  • Push the updates from your local branch to the corresponding branch.

Here’s everything you need to know about how to create a pull request and update status on GitHub. Just make sure you stick to the above steps for a successful contribution on GitHub.


About Initialyze

Founded in 2015 in San Francisco, Initialyze specializes in providing software solutions and services to help the world’s leading brands deliver transformation digital brand experiences. Our expertise includes Digital Strategy, Technology Implementation, Analytics, and Marketing. We strive to form strong partnerships with our clients to envision, design, and build innovative digital experiences efficiently and simply. Using an optimized implementation process and a suite of ready to use Initialyzers, we deliver on complex requirements quickly and cost-effectively without sacrificing on quality.