Have you been used a library on Github yet? And asking yourself How do they create its and how can you contribute your code?
Today, It's so easy to contribute to an open source project on Github. In this tutorial, I'll show you how you can step by step. Here you go!
Choose a project to contribute to
So many projects on Github to choose from. But you should choose a project as a dependency your own projects. Why??? Because you can find bugs or inconveniences. So you probably want to improve it.
Fork and clone it
The first we need to fork the repo to our Github by clicking the "Fork" button in upper right hand on the repo landing page. Like the image below.
After forking is completed, we need to clone the fork to our local machine. You can copy the clone URL
by clicking on green "Clone" button like image below.
End then, we open terminal screen on our local machine and run command:
git clone https://github.com/doankhoi/react-use-intercom.git
OMG! You should have a clone the repo on your local machine.
Get newest code
We should setup a new upstream remote to sync code from original repo:
git remote add upstream https://github.com/devrnt/react-use-intercom.git git pull upstream && git push
Make a new branch
We should make a new branch with convention at here. Example we want to make a feature and master is current branch.
git checkout -b feature/adding-api-base-property
Code it up!
Now we have a new branch and ready to start coding new feature on it. Always remember code styles and write new test to cover any features you have added.
Commit and push the new branch to the your fork on Github
To get a list files have changed you can run:
git status
Stage all files with command git add . Commit the staged files and push them to new branch.
git add . git commit -am "feat: add new property" git push origin feature/adding-api-base-property
Submit a pull request (PR)
After pushing is completed. We can make a pull request to merge to original repo from forked repo.
Done! Happy Coding
Nhận xét
Đăng nhận xét