Intellij IDEA Git executes "fork out of the warehouse" and "the latest version of the original warehouse" content synchronization update

1. Install git locally, right-click the git clone project on the desktop, when clone, check the branch, eg: 1.0.0

2, open Intellij IDEA, there is a Git in the lower right corner, click the triangle symbol, you can see the display of Local branches and Remote branches , at this time, there are only origin/1.0.0 and origin/master under the Remote branches (these two are private repositories after their own fork)

3. Create a new remote repository reference (in this step, you must find the directory where the project is located).
Find the directory where the project is located. For example, my project directory is in d:\idea_workspace\kr, enter the kr directory, right-click Git Bash Here, and enter the following command:
Steps:

3.1. Add a remote warehouse, which is just an empty shell at this time. If the content has not been synchronized yet, refer to the original warehouse address of the fork
git remote add Upstream https://github.com/AFNetworking/AFNetworking.git
(Note: The url must be the original warehouse address, for example, if you fork from a main project, fill in It is the address of the trunk, not your own, remember) 3.2. Update the remote warehouse and synchronize the content from the original warehouse address that references the fork. At this time, the master (trunk branch) of the original warehouse can already access git remote update Upstream 3.3 locally , pull (pull) data directly from the branch of the remote warehouse git pull Upstream 1.0.0









(Note: You can choose 1.0.0 or master here. Our project team agrees on the rules. Everyone submits to personal 1.0.0 first, and then merge request to 1.0.0 of the trunk. Once online, all masters are updated once. During this period, every submission is to 1.0.0 of the trunk, so pulling data is also pulling 1.0.0, which varies from company to company.)
So far, the remote warehouse reference of the project has been built, and the project in the idea is now Close and open, or close the idea, open it again, you can see the lower right corner mentioned in step 2, there are 4 Remote branches, and the extra 2 are Upstream/1.0.0 and Upstream/master 4, update the trunk The latest code idea of ​​1.0.0, select the project->right-click->Git->Repository->Pull, a dialog box pops up: Remote drop-down to select, the trunk Git address (Upstream/https://github.com/AFNetworking/AFNetworking .git) Branches to merge: select upstream/1.0.0, click pull (note: select 1.0.0 here, not master, the reason is mentioned above, because we are unified on 1.0.0 during development, after going online 5. At this time, you can see the console column, which files of the trunk have been pulled down, select the project, and you can see that all files are consistent with the 1.0.0 of the trunk, and updated to the latest code . Every time you update the latest code of the trunk in the future, you can execute step 4.












Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326491898&siteId=291194637