Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Pull request in github

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail the example analysis of Pull requests in github. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Pull request (Pull request)

1 Summary

Collaborators develop independently through a new code base in fork and contribute changes back to the original code base through Pull Request on Github. Among them, the requirement of Github is low, at least it is free to use, and the operation is relatively simple, so it is a good way to cooperate. The following will show the whole process of collaboration with pictures and texts!

2 step 2.1 Fork copy the original code repository

First Fork its code repository on the Github page of the original code base, and then a copy of the original code base is generated on your own Github. Note that there are two types of users: the owner of the original code repository and the owner of the Fork code repository.

Enter the original code base URL

Click the Fork button on the web page, copy the original code repository, and then jump to your Github account page.

2.2 Clone the Fork code repository locally

Next, use the git clone command to clone a copy of the Fork code base to the local computer.

Git clone git@github.com:HengStruggle/GitTest.git

Go to the cloned Git code base and modify the file, and then submit it to the local code repository.

Cd GitTest / / enter into the cloned Git code library

Print the contents of the GitTest.txt file, add your own user name at the end of the file, and then submit it to the local code repository. Note: a good habit is to build another branch on master, modify it, and then submit the new branch; the main branch is used to store the code of the original code repository

1 cat.\ GitTest.txt2 "version 0.2 by HengStruggle" > >.\ GitTest.txt3 git commit-- all-m "version 0.2" 2.3 Push native code repository to Github code repository

Next push the native code repository to the Fork code repository on Github, note that it is not the original code repository.

Git push-u origin master2.4 * one step: Pull request

Go to the GitHub page of our fork code base, select the branch that needs to be submitted to the original code repository, then click the Pull Request button, then click the new pull request button, and * reconfirm. Figure 1, figure 2, figure 3. Now that your task as a collaborator is complete, the next thing to do is to wait for the original warehouse owner to merge the code you submitted.

Figure 1

Figure 2

Figure 3

2.5 Pull requests received by the original warehouse owner are merged

As the original warehouse owner, there are two ways to merge received Pull requests. Description: it is recommended to merge on the local computer with strong flexibility.

2.5.1 merge on GitHub

To merge on Github, the first thing to do is to find the merge page. There are many ways to enter the merged page, one of which can open the main page on Github and click the bell icon in the upper left corner to view the recent Pull request; in addition, you can also view other people's request information directly on the left side of the home page. As shown in figure 4.

After ensuring that there are no conflicts, click the Merge pull request button, as shown in figure 5.

* the merger was successful, as shown in figure 6.

Note: to merge on GitHub, you must ensure that there are no conflicts

2.5.1 merge on the local computer

Create a new branch in the local warehouse before merging

Git checkout-b HengStruggle-master master

Pull the Pull request from the collaborator's remote warehouse to the local warehouse. Note that the Pull request branch here is not always master, depending on the situation. Note: what is pulled here is the Pull request branch of the collaborator's code repository!

Git pull https://github.com/HengStruggle/GitTest.git master

Regular merge branches and Push code

1 git checkout master2 git merge-no-ff HengStruggle-master3 git push origin master

Figure 4

Figure 5

Figure 6

This is the end of the article on "sample Analysis of Pull requests in github". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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: 0

*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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report