There are a lot of great open source projects on Github, and a lot of times we don’t just want to use them, we want to contribute to them. This post is about how to submit PR on Github and how to contribute to the open source community.
Fork the project you want to work on
Find the open source project you want to work on on Github (in the case of Ant-Design) and click the fork button in the upper right corner to create a copy of the open source project in your own repository, to which all subsequent code submissions will go. This way, you don’t have to worry about unaudited code messing up the original repository.
After the fork step is complete, create a copy of the open source project you want to work on in your repository.
Clone the new warehouse to local
Run the git clone command to clone the copy to the local PC (SSH is recommended to avoid entering the user name and password).
git clone [email protected]:astonishqft/ant-design.git
Copy the code
Modify the code and commit
Create a local branch and make code changes:
git checkout -b dev origin/master
Copy the code
After modification, submit the changed code:
git add xxx
git commit -m Submit 'XXX'
git push -u orign dev:master
Copy the code
By now the code has been modified smoothly and has been committed to your fork’s repository, so it is theoretically ready to commit PR. However, it is important to consider that the open source repository may also be synchronizing the code as you modify it, so you need to do a code synchronization before submitting the PR.
Use the git remote command to establish a link between the original repository and the local repository.
git remote add upstream [email protected]:ant-design/ant-design.git
Copy the code
Run git fetch upstream to fetch updates from the remote host locally.
git fetch upstream
Copy the code
Run git rebase to merge the updates. Git rebase: git rebase: git rebase: git rebase: git rebase: git rebase: git rebase: git rebase: git rebase: git rebase
git rebase upstream/master
Copy the code
How to encounter a conflict and execute the following command after the conflict is resolved.
Git rebase --continue
Copy the code
At this point, all the preparation work before PR is complete, and the PR operation can be carried out.
Submit a PR
Open the fork open source project on Github and create a pull request.
At this point, the whole process is over, and the next step is to wait patiently for Matainer’s review.
More exciting content welcome to pay attention to my public number!