How to make a successful PR?π€
Somya-Singhal opened this issue Β· 23 comments
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 status
to check the files you have modified. -
(Optional step)-> You can also do
git diff
to 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 -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
-
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!!β
Hi @TildaDares , I created an issue to help beginners to make a PR. Can you suggest changes if any needed?
Hi @Somya-Singhal, this looks really great. I think you missed the step of setting a remote for the fork. This article explains more https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github
This is great @Somya-Singhal
Thanks @TildaDares @on2onyekachi for encouraging me. I have updated the issue @TildaDares. Can you please review it and suggest further changes if it's needed?
Amazing work @Somya-Singhal!! You can share this in the chatroom so that other applicants know about it. Thanks!
Thanks @TildaDares for giving me an opportunity to help others, I will share this in the chatroom.
Hi @Somya-Singhal i love this! Perhaps you'd like to add a link to this from the README? That itself could be a first-timers-only issue if you'd like to create it?
Ya sure @jywarren, I will create an FTO issue and update you!
@Somya-Singhal , I am facing this issue in step 3, can you please help me.
Sorry for the delayed response, you have to first do cd \plots2
and then do step-3. Hope it helps! If you need any help you can ask here.π
Sorry for the delayed response, you have to first do
cd \plot2
and then do step-3. Hope it helps! If you need any help you can ask here.π
Ok thank you I'll look into it.:)
@Somya-Singhal still facing some issues :(
cd \plots2
Thank you for your help, but it's still showing the same error. :'(
cd \plots2
Thank you for your help, but it's still showing the same error. :'(
![]()
@Somya-Singhal still facing some issues :(
Hi @rajvidg , you can use command in your terminal ls
to list all folders and files. So, there you should see your plot2 folder. If not, you have located the repo somewhere else. Good luck.
@Somya-Singhal still facing some issues :(
Hi @rajvidg , you can use command in your terminal
ls
to list all folders and files. So, there you should see your plot2 folder. If not, you have located the repo somewhere else. Good luck.
okay thank you!
So should I use this path or what? Can you please help? :(@Somya-Singhal still facing some issues :(
Hi @rajvidg , you can use command in your terminal
ls
to list all folders and files. So, there you should see your plot2 folder. If not, you have located the repo somewhere else. Good luck.
Hi @rajvidg , as @Somya-Singhal mentioned above. Write just cd plots2
and hit enter. I can see you have written there
backslash \
(cd \
plots2). That's wrong.
Or just I hope it works in Windows as well.
Write cd
and hit tab key
and it offers you folder/s inside of this cloned_1
. Use tab key
again to jump on your desired folder and then hit enter. Good luck π€
Hi @rajvidg , as @Somya-Singhal mentioned above. Write just
cd plots2
and hit enter. I can see you have written there backslash\
(cd\
plots2). That's wrong. Or just I hope it works in Windows as well.Write
cd
and hittab key
and it offers you folder/s inside of thiscloned_1
. Usetab key
again to jump on your desired folder and then hit enter. Good luck π€
Oh, okay thank you!! :)