In daily front-end development, we often refer to third-party open source libraries or frameworks to improve development efficiency. Examples include jQuery, vue.js, iView, etc.
“Issue” or “PR” is used when the existing features of the open source framework do not meet our needs.
This article will use the Hey-cli-template as an example to explore how to contribute code to Github open source projects.
1. Demand background
The Hey-cli is a command-line tool that enables interactive scaffolding of projects with one click.
Hey-cli-template is a project template library referenced by hey-cli.
- simple webpack project
- simple react project
- simple vue project
- simple heyui project
- simple iviewui project
- simple elementui project
Now we want to add a Simple Heyadmin project to create a Heyadmin project with one click.
It would be better if you could PR directly. Finally (the author is very busy XD), let’s see how to PR!
2. Development process
Fork the Github project address to your own Github:
After Fork is successful, the following figure is shown:
Clone the previous step to fork the Github project to local:
git clone https://github.com/xxx/hey-cli-template.git
Copy the code
2.3 Establish a link with the Github project for PR:
git remote add upstream https://github.com/heyui/hey-cli-template.git
Copy the code
Link (origin) : link (upstream) : link (origin) : link (upstream) : link (origin) : link (upstream)
git remote -v
Copy the code
2.4 Creating a Branch (branch name can be customized) :
git checkout -b dev-ak
Copy the code
2.5 Modifying The Code
2.6 Push the current branch to its own remote repository:
git add .
git commit -m "xxxx"
git push origin dev-ak
Copy the code
2.7 After the completion of the previous step, the following prompt bar will appear in my Github hey-cli-template directory. Click and edit the content to submit PR:
2.8 After the submission is successful, a PR will be generated.
All done, then wait for the author check merge.
3. Precautions
Before each PR, remember to synchronize the code with the remote repository:
git fetch upstream
git rebase upstream/master
git push origin master
Copy the code
The above.