Using Eclipse as Development Tool

18
Using Eclipse as Development Tool Beta version 1.1 Ver. No. Date Particular Author 1.1 27 th January, 2015 Initial copy Naresh Aniyaliya Torry Harris Business Solution Document Owner:THBS Page 1 of 18

description

This is useful in setting up eclipse as develppment tool. This will explain the usage of github with eclipse.

Transcript of Using Eclipse as Development Tool

Using Eclipse as Development Tool

Beta version 1.1

Ver. No. Date Particular Author

1.1 27th January, 2015 Initial copy Naresh Aniyaliya

Torry Harris Business Solution Document Owner:THBS Page 1 of 18

Description :-

This document explains step by step solution to configure Eclipse IDE for easy access to git

repository. Accessing Git from Eclipse normally called as Egit. EGit gives better understanding, quite

effortless merging process, graphical representation of git fetch, pull, commit, merge and push process.

Installation of Git into Eclipse :-

The Egit plug-in can be installed into every Eclipse IDE installation. Usually EGit supports

the last two Eclipse releases.

Most Eclipse 4.2 and Eclipse 4.3 downloads from Eclipse.org contain Egit in their default

configuration. In this case no additional installation is required.

If the Egit plug-in is missing in your Eclipse installation, you can install it via the Eclipse

installation manager. Start this manager via the Help → Install new Software menu entry.

EGit can be installed from the following URL:

http://download.eclipse.org/egit/updates

Torry Harris Business Solution Document Owner:THBS Page 2 of 18

The dialog to install EGit is depicted in the following screenshot.

Torry Harris Business Solution Document Owner:THBS Page 3 of 18

Open “Git Repository Explore Perspective” :-

To work with Egit you have to open a perspective called “Git Repository Exploring”. To open

this, there is a button called “Open perspective” on right-up corner.

Click and select “Git Repository Exploring”.

Torry Harris Business Solution Document Owner:THBS Page 4 of 18

Configuring Egit with your username and Email :-

Eclipse uses the same configuration files as the Git command line tools hence if you have

configured your Git setup via Eclipse or via the command line, both will be using the same setup.

Before using Git you must configure your name and email address which is used to fill the

author and committer information of commits you create.

The Git configuration settings can be adjusted via the Eclipse preference setting. Select

Window → Preferences → Team → Git →Configuration to see the current configuration and to

change it.

You can add entries to your Git configuration by pressing the Add Entries button on the Git

Configuration preference page. To add your user, use the user.name as key and your real name as

value. Repeat the procedure for your email address.

Torry Harris Business Solution Document Owner:THBS Page 5 of 18

You can add more values in this dialog. These values are stored in the same way the Git

command line would store them, so that you can use EGit and Git for the same Git repository.

Configure default clone location :-

You can also configure in Eclipse the default folder for storing Git repositories via the Window

→ Preferences → Git → Team →Default Repository Folder entry.

Working with your Github repositories :-

EGit has a Git repository view which allow you to browse your remote repositories from

github or everywhere, clone Git repositories, checkout projects, manage your branches and much

more.

The toolbar entries allow you to add an existing local Git repository to the view, clone a Git

repository and to create a new Git repository.

Torry Harris Business Solution Document Owner:THBS Page 6 of 18

Cloning an existing project

Eclipse allows you to clone an existing Git repository and to import existing projects from this

repository into your Eclipse workspace by using a wizard.

Select File → Import → Git → Project from Git or Click on “Clone repository” button from

left-up corner.

Torry Harris Business Solution Document Owner:THBS Page 7 of 18

Select “Clone existing repo” button it gives a window which shows different options to clone.

Select Git → Project From Git.

If you had clicked the “Clone existing repo” button then you'll land up directly to the third step.

Torry Harris Business Solution Document Owner:THBS Page 8 of 18

Click on Next. Now it gives options to use locally created repository or clone. Select Clone

URL and hit the Next button

Torry Harris Business Solution Document Owner:THBS Page 9 of 18

Enter Complete URL of repository. Enter User and Password details in authentication section if

requires and hit Next

Torry Harris Business Solution Document Owner:THBS Page 10 of 18

Select branch/s to clone from Remote repository and hit Next

Torry Harris Business Solution Document Owner:THBS Page 11 of 18

Select Destination where to fetch this repository and Initial branch to use as your development

work then hit Finish

And yupp we have our project from remote repository to our Egit which look like :-

So now you access the project code and modify however you want. Now time to committing the

changes you had done so far.

Torry Harris Business Solution Document Owner:THBS Page 12 of 18

Commit the changes you had done :-

Committing the changes can be done in many ways. Here I had describes two ways like

1. Commit using git staging view

2. Commit changes directly from the project inventory window

1. Commit using git staging view

Eclipse gives you several options to stage and commit your changes. The Git Staging view

provides a convenient compact overview on all changes you have done since checking out a

branch.

Open the Git Staging view via the Window → Show View → Other... → Git → Git Staging

menu.

Torry Harris Business Solution Document Owner:THBS Page 13 of 18

If you had changed anything but not staged it will show in “unstaged changes” section. If you

staged the files then it shows in “staged changes” section. You can always drag and drop the files

between these section to stage and unstage.

If module is not staged you can staged it or you can replace the changes with you HEAD revision :

Torry Harris Business Solution Document Owner:THBS Page 14 of 18

staged the changes and put a nice commit message then you can commit or commit and push from this

window.

2. Commit changes directly from the project inventory window :-

The Git Staging view is a very convenient way of working with Git as it gives you a grouped

view of all the pending changes without an additional dialog.

If you prefer to invoke the Git commit dialog directly you can do this via selecting the Team

→ Commit dialog or you can directly right click on project and choose commit.

The dialog allows you to add changed and new files to the staging area and commit the changes.

Torry Harris Business Solution Document Owner:THBS Page 15 of 18

Here after √ symbol it shows status of the file. Here it means the module has been modified but

not committed. The most important icon decorators are depicted in the following screen-shot and their

description in the table below

Torry Harris Business Solution Document Owner:THBS Page 16 of 18

Table 2. Sample Table

State Description

staged Changes in the file will be include be included in the next commit.

added to

index

Staged but not yet committed, i.e. snapshot of this file has been stored in the git database.

This status is the same as the staged status, but the file wasn't under Git version control

before.

dirty File has changed since the last commit.

Ignored File is flagged to be ignored by Git operations.

tracked File is committed to the Git repository and has not changed.

untracked File is neither staged nor committed.

Torry Harris Business Solution Document Owner:THBS Page 17 of 18

The things we can do easily in Egit, you can see by clicking on project. Just right click on project

which shows

Torry Harris Business Solution Document Owner:THBS Page 18 of 18