Skip to content

How to make a successful PR?🤔 #300

@Somya-Singhal

Description

@Somya-Singhal

To help beginners who have started their journey to open source, I am writing few steps to create a successful PR.

  1. Click on the fork icon present at the top right corner of the repository.
    Here is the link of the repository (https://github.com/publiclab/infragram)

    This step will create a copy of the main repository so that you can modify it.

pl-4

  1. Now you have to clone the repository.
    For this first copy the URL by clicking as shown in the below demo image.

pl-5

Then after creating a folder in your desktop, open bash shell and type the command(but remember to replace "url" in the
below command with the url that you have copied above)
git clone <url>

This step creates a copy of the repository in your own computer.

  1. Now you have to create a new branch(as the whole code workflow is in main branch so whenever any issue needs to be
    solved it is necessary that we make changes on a separate branch so that it does not disturbs the whole workflow and
    later it can be reviewed and merged)
    Command for creating a new branch(remember to replace "name-of-the-branch" with the name you like to give for the
    branch)
    git checkout -b <name-of-the-branch>

  2. Open the file where you want to make changes and make all necessary changes that's required to fix the issue you are
    working on and save it.

  3. (Optional step)-> You can do git status to check the files you have modified.

  4. (Optional step)-> You can also do git diff to see the lines which you have deleted or modified.

  5. Now to add the files you have modified, do git add <name-of-the-modified-file> (Remember to replace "name-of-the-
    modified-file" with the name of the file(s) you have modified).

  6. Now to commit the changes, do git commit -m "<write-a-message-here>" (Remember to replace "write-a-message-
    here" with the message fitting according to the issue you are fixing)

  7. Now do, git push --set-upstream origin <name-of-the-branch> (Remember to replace "name-of-the-branch" with the
    name that you have given to the branch in step-3)

  8. Now we have to configure a remote for the fork, then sync the fork(this step is done to keep your local copy of the
    codebase up to date)
    To configure a remote for the fork, write the following commands:

    • git remote -v
    • git remote add upstream https://github.com/original-owner-username/original-repository.git
      [For this project this command will be: git remote add upstream https://github.com/publiclab/infragram.git]
    • To see the upstream repository was properly added, write the following command git remote -v

    To sync the fork, write the following command: git fetch upstream

  9. Now we have to switch to local main branch of the repository, for this, write command: git checkout main

  10. To merge any changes that were made in the original repository’s main branch with our local main branch, write command git merge upstream/main

  11. Now you can go to your github and see there git will automatically show "your recent pushed branches", there click on "Compare & pull request" and you can add the message you want so that it will give insight about issue that you had fixed and finally click on create a pull request.

Done!!✌

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions