In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Programmers know that gitHub is a hosting platform for open source and private software projects, hosting many excellent projects, such as linux kernel source code, git source code, machine learning framework tensorflow and so on. Of course, in addition to these top projects, there are also a large number of excellent projects developed by experts. All of these projects, we can contribute code to it.
So how do you contribute code to these projects? Let's explain it with an example.
For example, there is an awesome project githubTest on gitHub. Its author is Alvin. The address of the project is as follows:
Https://github.com/yychuyu/githubTest
Now Harry sees the project and wants to contribute code to it. To achieve this, Harry completes these steps in the following figure:
1. Fork
After Harry finds the project, click the "fork" button in the upper right corner. After a while, the same project githubTest, including files, submission history, issues, and other things, will be cloned under the Harry account.
2. Clone
After passing fork, the githubTest project is also available under Harry's account, but it cannot be compiled or modified (it can actually be modified, but not recommended).
At this point, you can use the git clone command to clone the project to your computer.
3. Update a file & 4. Commit
Next, Harry is free to make changes to the project. However, it is not recommended to modify the master branch directly. It is recommended to cut out a dev branch based on the master branch, and then play freely on the dev branch. After the modification, merge the dev branch to the master branch.
5. Push
After you have modified the code on your computer, use the git push command to synchronize the changes to your gitHub project repository.
After doing this, you can see your submission in the code repository.
6. Pull request
The next step is to submit your code to the original author Alvin. First click "New pull request" on the file list.
After that, gitHub automatically compares the source warehouse branch with its own warehouse branch code to see if there are any conflicts. If it shows "Able to merge", Harry can click the "Create pull request" green button below to submit the code.
After that, the system will ask you to write a comment, but you don't have to. But it's best to write it down and explain to the author what you changed and why.
Through the above 6 steps, the original author Alvin will receive a pull request, as shown below:
Alvin can then click in to see what changes Harry has submitted. If he thinks the change is really niubility enough, it can click "merge pull request" to integrate the Harry submission into his project.
At this point, the merit is satisfactory, and Harry has successfully completed a code contribution to the project githubTest.
However, this project is so outstanding that many experts have seen and contributed a lot of code. For example, now Alvin has submitted a file itself:
Now that the original author project has changed, how can the githubTest under the Harry account keep pace with the original author Alvin project? Harry needs to do the following three steps:
1. Fetch
Now that the code is out of sync, we have to fetch the code of the Alvin warehouse to the warehouse of our own computer. Note that this is done on your own computer, not on github.
Git fetch git@github.com:yychuyu/githubTest.git master:latest
The above command, the part after git fetch, is the git address of the original author's Alvin project, which can be seen by clicking the original project "clone or download" button. After that, in the part of master:latest, master is the original project branch and latest is its own project branch. If the latest branch does not exist, it will be created automatically. It is also possible to fetch the code to your own master branch, but it is not recommended.
2. Merge
After the code fetch to the latest branch, cut to the master branch, and then use the git merge command to merge the latest code into the master branch.
3. Push
Now the code on the Harry computer is in sync with the original project code. Using the git push command again, we can push the latest code to the githubTest project under the Harry account.
The specific operation process of the above three steps is shown below.
Next, Harry can continue to contribute its own code on this basis.
For more exciting content, please follow the official account good Linux. The public reply 1024 can get 5T technical materials for free, including: Linux,C/C++,Python, raspberry pie, embedded, Java, artificial intelligence, and so on. Reply to join the group in the official account and invite you to join the master such as cloud technology exchange group.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 271
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.