I was invited to an organization account on GitHub. To edit a repository, I thought I could just git clone
it, make changes, and then simply git push
it. No. I didn’t have the access.
Then, how to contribute? I first thoguht about Fork. But Isabel Constantino and Professor YY recommended creating a new branch, making changes, and submitting a pull request.
I then wondered: what’s the difference between forking and branch? I found the same question on this thread . Basically, when you fork a repo, you are thinking of building on it for your own purpose and might not merge it with the original repo. However, when you create a new branch, your intention is to directly contribute to a project. That said, you can of course fork a project with the intention to contribute to it. I’ve talked about how to make a pull request on this post . Now, I want to talk about how to create a new branch and make a pull request.
I found the solution here . I’ll summarize the steps here myself:
-
First, copy the url of the project you want to contribute to. On your computer, change directory. For example,
cd Desktop
. Then, clone this repository in the current directory:git clone yourRepoURL
-
Change directory to this repository
-
Create a new branch by
git checkout -b NewBranchName
-
Make changes to the repository, and then
git add .
1 -
Commite your changes to your new branch:
git commit -m "your message here"
-
Push it to the repository:
git push -u origin NewBranchName
2 -
Go to the target repository, and you’ll find the option to make a pull request
Done!
Last modified on 2022-01-31