Read GitHub open source right way

Foreword

  Read the open-source project started recently found inappropriate whole new code, the lack of an iterative project implementation process, submit the code thinking if you can see just fine for the problem, so there is this blog.

  Mainly related to the text: How to fork open source project, how to ensure that local warehouse code update to the latest version.

  In this paper, an open source project Flink example.

1, the overall process

  fork project =====> Download Local ======> Import IDEA, configure git to get the code submission process =====> update code

2, fork project

  To fork on GitHub open source project, we first need a GitHub account, the registration process can Baidu, not to proceed here in detail.

  Found on GitHub open source project required, fork top right, click, automatically creates a repository on GitHub own, as follows:

3, download the code

  In order to obtain the submission process contributer, where use is recommended to use git in their own warehouses obtain the source code in.

  clone of the original project directly in the git URL also possible, but if you want to contribute to the original project? Direct reference to the original code to the open source project certainly not put up (of course, is not necessarily no, say only general). Process to submit code to the original project generally: submit code to own GitHub repository, then new pull request to the original project warehouse, to the time of the original project will be whether to merge your code under the circumstances.

  The process to obtain the URL below:

  Tip: If you download the source code from GitHub slow, you happen to be with a laptop, you can use a hot download, amazing speed, just do not know why.

 4, introduced IDEA, submission process configuration acquisition git

  Flink is because maven project, so the import process only need to select the "Import an existing project" in the IDEA, select the pom.xml file.

  The process involves the following:

  1) Java version of choice

    wiki formal open-source projects will illustrate the appropriate JDK version, usually in the following README.md GitHub project file or project on;

    Required scala version, maven empathy;

  2) Configure git

    The configuration procedure of Baidu.

  The effect is as follows:

 5, update code

  In order to understand the progress of the project, you can take the following steps to update the local code:

  1) the original project configuration address

git remote add upstream <original warehouse github address> // such as: https: //github.com/apache/flink.git

    2) to view the current address of a remote repository and warehouse former warehouse address

git remote -v

  3) Get updates of the original warehouse

git fetch upstream

  4) merging into the branch

git merge upstream/master

  5) Check local update

git log

  6) update their own fork of GitHub repository

git push origin/master

   Native code update also can update repository on GitHub, and then use git pull to update local repository, but this method encountered a situation I can not get the latest version of the branches during use, the specific process, reference may Ref [1 ] .

  Personal recommended way to git commands mentioned herein update.

  Further, the use git pull code from GitHub process, RPC failed problems may be encountered, reference may Ref [2] .

Ref:

[1] https://www.cnblogs.com/eyunhua/p/8463200.html

[2] https://www.cnblogs.com/zjfjava/p/10392150.html

 

Guess you like

Origin www.cnblogs.com/love-yh/p/12535808.html