-
Notifications
You must be signed in to change notification settings - Fork 165
Description
To help beginners who have started their journey to open source, I am writing few steps to create a successful PR.
-
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.
- Now you have to clone the repository.
For this first copy the URL by clicking as shown in the below demo image.
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.
-
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> -
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. -
(Optional step)-> You can do
git statusto check the files you have modified. -
(Optional step)-> You can also do
git diffto see the lines which you have deleted or modified. -
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). -
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) -
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) -
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 -vgit 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 -
Now we have to switch to local main branch of the repository, for this, write command:
git checkout main -
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 -
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!!✌