First of all, dare to take this step. It doesn’t have to be difficult to think about. Even in a project of the spring level, ordinary people can get involved.
Start small and don’t aim too high
Some people start with the idea of contributing core code to an open source project, which is unrealistic, especially in a project of The Spring level, where the code is written in strict accordance with official requirements and requires comprehensive test cases. Once committed, they are vetted by Spring officials, often not merging into the main branch for a month or two.
So start with the simplest things, like documentation, comments, simple logic errors, etc. Not only are these places easier to get started, but they also have a better chance of official approval and are quicker to merge.
Some of you might say, well, what’s that? It’s a contribution. Sure, these are small things, but if 10,000 people did these little things, they would add up to make a huge difference to the program.
These other little things will help you get started on the project and lay the groundwork for core code submission later.
Identify problems at work
While contributing to open source projects is encouraged, it is not necessary to research an open source project unless you specifically want to work on it.
Like me, I find more problems in my work and then solve them easily. It’s easy to lift a finger. All for one, one for all.
Said so much is to hope that we do not aim too high, even if it is a small problem, encountered later smoothly solve, is also a contribution to the cause of open source.
Next, I’ll show you how to contribute code to a Spring project through a very simple example.
case
When I was encapsulating the Redis action class (see customizing the Redis action class based on RedisTemplate), I found
Spring – data – redis – 2.1.11. RELEASE – sources/org/springframework/data/redis/core/ListOperations. Java
The leftPush() method does not match the description validation, and the url and command given to Redis are wrong
A similar situation applies to the rightPush() method on line 177
At first, like most people, I was too lazy to take care of such a trivial matter. Later, I thought that some people might have misunderstandings, so I still tried to fix it for the official, which could also be a small contribution to the Spring project.
Some people might want to say why not just change a comment? What a contribution! For this kind of person I just want to say, it is because of people like you, so this small mistake has not been left until now!
The whole process
The whole process is divided into five steps
- The fork project
- Commit the contribution code to your own fork project
- Go to Spring Jira and create a problem and get a unique identifier
- Pull requests with unique identifiers
- Awaiting official approval
The fork project
Click fork to make a copy of the current project to your own repository
Commit code to your own fork project
Go to your repository and download the project
And then after you’ve modified it locally, commit it and push it to your remote end.
Spring projects have code formatting requirements such as reduction. refer to the Spring project contribution guidelines, which provide formatting tools
Note that spring projects use TAB indentation instead of four Spaces
In spring’s official error tracker, create a problem
Spring JIRA is the official error tracker of Spring. It is open to the public, supports Chinese, and is easy to register, directly through github authorization.
Once you’ve created it, add a question to it, filling in as many details as possible, for example
The problem of the previous method not matching the description has been solved and cannot be demonstrated. This is a new problem. (Yes, I later discovered a comment error.)
Once created, the ticket is automatically generated, as shown in the red box
You’ll need it when you copy it
pull requests
Once you have the dataredis-xxx ticket, pull requests are ready
Check your code and create it if it’s okay
The most important step is to read each step carefully. It describes spring’s submission format and other requirements
After you understand the rules and regulations, start the formal submission
Note that fill in the red box in accordance with Spring’s requirements
Submit after confirmation
Waiting for audit
Submit and wait for review
If you are the first to contribute this code, you will also be asked to sign an agreement.
merger
After you submit, someone will process it. If the authorities think there is no problem, they will merge your submission as follows
Once the merge is complete, the main branch code will look like your modifications, and you will be named as a contributor to the project
Afterword.
The second pull request also passed, albeit slower than the first