RTA Knowledge Base

Introduction

EGit is an Eclipse Team provider for the Git version control system. This Tutorial describes the basic use cases for EGit. It requires only some basic knowledge about the Git processes.

Configuring Proxy within ISOLAR-AB

To download git for ISOLAR-AB, first the proxy has to be configured by doing the following:

  1. In the menu bar at the top of the screen, navigate to Windows > Preferences > General > Network Connections.
  2. Select the "Active Provider" dropdown and select "manual".
  3. Next, configure HTTP, HTTPS and SOCKS to a proxy configuration. (e.g. for CNTLM use Host : "localhost"  and Port : 3128 )
  4. Apply the changes.

Installing EGit in ISOLAR-AB

  1. Navigate to Help > Install New Software.
  2. Press the "Add" button in the top right. 
  3. Set the Name as "git"  and the Location as "https://archive.eclipse.org/egit/updates-4.7/"
  4. Press the "Add" button after filling the fields as shown below.

      5. Now a selection of modules should appear, within the "Git integration for Eclipse" dropdown select "Git integration for Eclipse" and "Git integration for Eclipse -  source code" .

      6. Ensure the "Contact all sites during install to find required software" is enabled as shown below.

      7. Press Next.

      8. Follow the installation wizard through, agree to the Terms and Conditions and press Finish. 

      9. Now ISOLAR-AB should prompt a restart.



Configuring EGit

  1. Every commit in EGit will include the user's name and his email-address. These attributes can be set in the Preferences-window.
  2. Navigate to Window > Preferences > Team > Git > Configuration.
  3. Here you should be able to set the credential selector to "wincred". This should fill in your email, name.



        4. While in the Git configuration settings you can also change other settings such as the location in which it will clone repositories into.


Use Cases

Cloning a Repository

In order to checkout a remote project, you will have to clone its repository first. Open the ISOLAR-AB Import wizard (e.g. File > Import), select Git > Projects from Git and click Next.

Select “URI” and click next. Now you will have to enter the repository's location. Entering the URI will automatically fill some fields. The first time you clone a repository within ISOLAR-AB it will require you to enter your authentication details. Select "Store in Secure Store" and it will autofill in the future.


Following this press Next. You will be presented with all remote branches for the repository link you entered. Select all branches you want to clone and press Next again.



Finally you can name the local directory in which the branch will be cloned into. Following this press Finish and the branch will be cloned.

Once the branch has been cloned any projects within (e.g RTA-SK within a SK) will be shown to be imported into ISOLAR-AB.


Creating a New Repository

First you have to create a project that you want to share via your local repository. (For an example of this please see the "Getting Started Guides".

After you have created your project, right click on the project and navigate to Team > Share Project. Here you will be able to select an existing repository or create a new one. 




The new repository will be empty even though the new project is assigned to it. Before you can commit all the files within the project to the repository you first need to add them. Right click on the project and navigate to Team > Add. If there are any files you don't want added you can also use Team > Ignore.

After adding/ignoring the relevant files, you now need to commit using the "Commit" button. 


How to Commit

After making changes to a file within a project that already is setup as a git repository you need to commit the changes. To do this save the file you have changed, right click on the file and navigate to Team > Commit.

Here you will be presented with unstaged/staged changes. To commit your changes to a file, stage the file and add a commit message in the provided window. From here you can either "Commit" or "Commit and Push" using the buttons provided.



How to Revert Changes

If you want to revert any changes there are two options, compare each file you want to revert with the HEAD revision and undo some/all of the changes. Or you can reset your project causing all changes in the working directory to be reverted.


A) Revert by Compare

Right Click on the file you want to revert and navigate to Compare With > HEAD Revision. This will open a comparison with the HEAD Revision, highlighting any changes. From here you can completely revert your file by pressing the "Copy All Non-Conflicting Changes from Right to Left" button. Alternatively you can select a few lines before pressing the mentioned button to revert the highlighted lines. 

To complete the reversion you will have to save the comparison or local copy of the file.


B) Revert By Reset

To reset all changes made to your project, right click on the project and navigate to Team > Reset. From here you can select the branch you want to reset to and choose "Hard" as the reset type. All changes in your workspace will be lost using this method.


How to Create a New Branch

To create a new branch in your project, right click on the project from which you wish to branch off and navigate to Team > Switch To > New Branch. From here you are able to select the branch you wish to branch from, from there press "new branch"  and enter a name for the new branch.


How to Merge

To merge one branch with another, you have to checkout the branch you are wishing to merge with. Right click on the project and navigate to Team > Merge. From here you can select any branch to merge with. The merge will execute and a window with the results will popup as a result. These will results can be of the form: "Already up to date", "Fast-forward", "Merged",  "Conflicting", "Failed". If the result is a conflict then the process isnt complete and you have to manually resolve the conflicts by opening the conflicting files and scrolling to any conflicting changes marked with "<<<<<<<<<<<<<". See example below:


How to Fetch/Pull

This can be done from right clicking on the project and navigating to Team > Pull which performs a fetch and pull or Team > Fetch From...  which just performs a fetch.


How to View a Files History

You can show any files history within ISOLAR-AB  by right clicking on the file and navigating to Team > Show in History. Now a History view will open giving a view of pervious commits.

In this view you can: compare, create branches, reset etc.