Use of Git plugin in Eclipse, branch creation, branch upload, branch merge

Git branch handling

 

1. Function introduction

Git is an open source distributed version control system that can effectively and quickly handle project version management from small to very large. At present, this function is based on the company's internal Eclipse development tool, which has integrated the Git plug-in, which is very convenient to use. For the first use configuration of Git, the remote warehouse project, clone into eclipse, here is not too much overview, you can refer to Address below:

https://blog.csdn.net/liuchunming033/article/details/43274733

 

2. Branch creation

1. On the Git Repositories working interface, find the git project to be operated (for example: testgit), Branches branch, right click on the Local local folder,

Switch to --> New Branch...

 

2. Fill in the name of the branch to be created (for example: dev), other items can be defaulted, and finally click finish to complete the creation of the branch.

 

3. Due to the newly created branch, there are multiple branches. Here are added methods for switching multiple branches, such as switching the dev branch back to the master branch. First switch back to the Package Explorer interface, select the git project to be switched, right click, Team --> Switch To --> master, after the operation, it will switch to the master main branch at the arrow in the figure below.

 

3. Branch upload

1. There are two cases of branch uploading. First, you edit and update the data in the branch from your own workspace. At this time, you need to submit the updated data to the local warehouse. For example, for the newly created branch dev Upload to the local warehouse. On the Package Explorer interface, first determine that the branch is the dev branch. The specific operations are as follows:

Right click --> Team --> Commit;

 

2. Submit and upload to the git remote warehouse from the local branch, the operation is as follows, in the Package Explorer interface, right-click the project, Team --> Reote -->Push;

 

Four, branch merge

1. The idea of ​​​​integrating the branch and the main branch, first switch to the branch dev, update your own data, after the test is ok, then submit the data to the local library, and then upload it to the git remote warehouse;

 

2. Switch to the main branch master and integrate the dev branch. However, since the version number on the master branch may be higher than that of the dev branch, an integration error will occur when the same file is integrated.

The integration operation is as follows:

Next, other items are defaulted, as shown in the figure:

 

3. The following is an example of an error in integration. Here, the error file is App.java, and it is a red conflict file. The error is as follows:

 

3.1 Manually integrate errors, keep your own updated data on dev and the updated content of the integrated master branch, and delete the error message: <<<<<<< HEAD , ======= , >>>>>>> > refs/remotes/origin/ dev

 

3.2 Report the error file App.java in the project, add it to the git version control, and the red prompt will disappear.

 

4. After the above operation is completed, the master main branch and dev branch data are integrated, but at this time the latest data is only saved to the master's local warehouse, remember to upload it to the remote warehouse of git.

 

Guess you like

Origin blog.csdn.net/w2462140956/article/details/87860163
Recommended