Use Version Control in eclipse -- git

Source: Internet
Author: User
Tags version control system

Most of the version control software used in the previous software development process is CVs, SVN, and so on, all of which belong to CVCs and the central version control system. It features a central database, the developer downloads, edits, and submits the code from the central database. One obvious feature is that the version control of the CVCs type requires developers to connect to the central database, so you need to connect to the Internet. If You Want To Do development at home, so your SVN server must have a real IP address. The git I introduced today is also a version control software that has replaced the previous two trends. Git is a DVCs, a distributed version control system. That is to say, there is no central library (but your final code will be put in a certain location and free registration will be provided on GitHub ). For example, if you download an open-source project from GitHub, a complete copy of the Project will exist on your computer, and your computer will become a repository in the future, this library is similar to the Central Library Function in SVN, but it is only for you. After development, you can push your code to the remote database. (Haha, the expression capability is limited. I don't know whether to clarify it ...)


OK. The following is the question:

1. Install the egit plug-in, which is not described here.

2. After installation, you must first configure:

Window-> preference-> Team-> Git-> Configuration click Add entry

Key user. Name = *****

Value user. Email = ***@****

Used to identify a developer.

3. A. Create a Java project gitdemo, right-click the giddemo and choose team> external project. after the project is completed, Team> commit

B. Select a project, right-click team, and choose commit. Remember that your project has been saved to the local repository. E: \ gitdemo is my local repository.


C. register an account on GitHub and create a repository. I will not describe it in detail here. I will provide a self-built warehouse

Https://github.com/yuanzeyao2008/Hello.git

D. Select a project, right-click the project, and choose team-remote> push. Enter Your repository address. the user name and password do not need to be specified.


E. Next Step

F. Keep going to the next step and know that it is complete. After that, you can go to GitHub to see if it is successful.

The following describes how to implement version control:

Here, I define two developers: A and B.

A and B are very interested in open source projects. Therefore, they will talk about downloading the project and importing their own projects. According to the above introduction, a local library needs to be created locally:

  • Import project: import-> Git-> fromgit. The following page is displayed:

Here, because we use a remote database, select URI. The following interface is displayed:

 

Next step

Next step

Next step

There are three methods:

  1. Import existing projects: if the project in the working directory in your library contains the. project file, you can use this
  2. Use the New Project Wizard, which seems to be equivalent to creating a new project. It is rarely used and is not clear.
  3. Import as general project. If there is no. Project, you can use this.


After that, the project will be imported to your eclipse.

Now developer A creates a student class

Public class student

{

Int ID;
}


Developer B has also developed a student class.

Public class student

{

Int mid;
}


However, if a is submitted to the remote database and B is submitted, it cannot be submitted directly. This is similar to SVN. First, retrieve the latest code in the remote database. Step: right-click team-> pull. if a conflict is found, right-click team-> merge too. This is the conflict that B developers need to negotiate with a developer, for example, the negotiation result is to change the ID field to PID, and then submit B to the remote server. This is a simple modification to retrieve the latest code through pull.


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.