Friday, July 20, 2012

Git support in Eclipse


Git is an open source distributed version control system designed to be fast, written in C, developed by Linus Torvalds for Linux kernel development. Distributed nature of this tool actually means that you are not doing a classical checkout of the source code. Instead, you get a clone of the entire repository. Thereby, every user basically has a full backup of the main server and each of these copies can be used to replace the main server in case of the crash/corruption.

Also, since you don't have a single server where all developers push their changes as in a centralized systems, you may use it in quite a different manner. There's a short overview of the common workflow styles on the official Git page.

Most people moving from a centralized system like myself prefer a "centralized workflow" where Git will not allow you to push the changes if someone has pushed since the last time you pulled. However, you might find that some other workflow styles suite you just as well.

Installing Eclipse plugin for Git

Now let's see how you can enable Git support in Eclipse.

Go to Help/Install New Software...
Select Work With: All Available Sites, and type 'Git" to filter results.

Select EGit and click on Next.

Proceed with installation by accepting license agreements and you'll soon have your IDE ready to go.

Now you can import some Git project and start coding. :)

Using Git Repository Perspective

If you want to clone a Git repository, open Git perspective (Window/Open Perspective/Other... select Git Repository Exploring).

Click on the "Clone a Git repository and add the clone to this view".

Fill in repository details. By the way, repository referred in this example contains code samples for a great series of tutorials written by Krams.

Wait for the system to recognize the branches and proceed.

Choose a local destination.

Click Finish and enjoy! You may now right-click on the repository and take some action.


No comments:

Post a Comment