Working with GIT Repositories using TimeStorm

If you're new to Git or distributed version control systems generally, then you might want to read Git for Eclipse Users first. More background and details can be found in the online book Pro Git.

The TimeStorm IDE provides support for the Git version control system. You can easily perform the necessary Git commands like commit, merge, rebase, pull and push via the TimeStorm IDE.

This document will show How to use GIT in TimeStorm following the steps below.

  1. User Configuration
  2. Create Local Git repository in TimeStorm
  3. Import Existing Project from Remote Repositories
  4. Performing Git operations in TimeStorm

1. User configuration

Whenever the history of the repository is changed (technically, whenever a commit is created), Git keeps track of the user who created that commit. The identification consists of a name (typically a person's name) and an e-mail address. This information is stored in file ~/.gitconfig under dedicated keys.

In TimeStorm, you can configure the user in two ways. Follow anyone as per your wish.

  1. Configure the user with the existing .gitconfig file
  2. Configuring the user by using the TimeStorm ‘Add a configuration entry’ wizard

1.1. Configure the user with the existing .gitconfig file:

If you have already configured Git for the command line and .gitconfig file is created under the home directory which has the following information as shown below.

In the TimeStorm IDE, you can point to the existing .gitconfig file in the Window --> Preferences --> Team --> Git --> Configuration --> Location as shown below.

1.2. Configuring the user by using the TimeStorm ‘Add a configuration entry’ wizard:

In your TimeStorm IDE, select the Window → Preferences → Team → Git → Configuration → Add Entry button. In the ‘Add a configuration entry’ wizard, for the user the user.name key and enter a value and click on Add button as shown below.

Similarly, for the email the user.email key and value added as shown below.

2. Create a local Git repository in TimeStorm:

You can use the local private repo for tracking your project changes during your development and debugging. You can share the local repo by pushing it up to the remote repository. The following steps explain how to create a new local Git repository in TimeStorm.

  1. Create a new Git repository
  2. Create a TimeStorm Project
  3. Add Project to the repository
  4. Using the Git Staging view for the initial commit
  5. Review your commit history via the History view

2.1. Create a new Git repository:

Open the Git Repositories view via the Window Show View → Other → Git → Git Repositories menu as shown below.

The GIT repository toolbar will open as shown below.

Select the “Create a new local Git repository” option to create a new repository. This opens a dialog that allows you to specify the directory for the new Git repository. Select a new directory outside of your workspace by clicking on the “Browse” button. By convention, this directory is a subdirectory in the git folder of the user's home directory.

Press the “Create” button. Now the Git repository is created and a reference to it is added to the Git Repositories view.

2.2. Create a TimeStorm project:

To create a project in TimeStorm, please follow the How To Create and Debug Hello World in TimeStorm document

To illustrate, create a HelloWorld project as shown below.

2.3. Add Project to repository:

To put your new project (Example: HelloWorld Project created in Step2) under repository with Git, right-click on your project, select Team → Share Project.

Afterwards, select your existing Git repository (Sample-repository created in the Step1) from the repository drop-down list.

Press the Finish button. Your project is now moved to your Git repository.

The following screenshot shows the directory in the Git Repository view. The .git directory contains the Git repository, the other directories contain the files of the working tree.

2.4. Using the Git Staging view for the initial commit:

Open Git Staging (To stage a file is simply to prepare it finely for a commit) view, via Window → Show View → Other → Git → Git Staging as shown below.

In this view drag all files into the Staged Changes area, write a meaningful commit message and press the commit button.

Doing a change and committing it:

Change the puts message in your HelloWorld.c as shown below.

In the Git Staging view drag only the HelloWorld.c into the Staged Changes area, write a meaningful commit message and press the commit button.

2.5. Review your commit history via the History view:

The History view allows you to analyze the history of your Git repository and to see to which commits the branches and tags points. This view displays the author, date, commit message, and the modified files of commits.

Open the History view via the Window → Show View → Other → Team → History menu entry.

Use it to review which files were included in your individual commits as shown below.

For more information on the local repository, please refer to https://wiki.eclipse.org/EGit/User_Guide/Getting_Started

3. Import Existing Projects from remote repositories

Using the Git Clone Wizard you may clone remote repositories using different transport protocols. Please follow the Import Existing Projects from GIT document to import the existing projects from your remote repository into your workspace.

4. Performing Git operations in TimeStorm:

Pull, push and fetch

You can use the Git Repositories view to pull, push and fetch to remote repositories. Right-click on your repository and select the appropriate operation.

The most important operations are described in the following list. Select:

  • Team → Add to index, to add the selected resource(s) to the Git index
  • Team → Commit, to open the commit dialog to create a new commit
  • Team → Create Patch…​, to create a patch
  • Team → Apply Patch…​, to apply a patch to your file system
  • Team → Ignore, to add a file to the .gitignore file
  • Team → Show in History, to display the history of the selected resources(s)
  • Team → Pull to pull in changes from your remote Git repository
  • Team → Fetch to fetch the current state from the remote repository
  • Team → Switch To to checkout existing or create new branches
  • Team → Push to push changes to your remote Git repository
  • Team → Tag to create and manage tags.

Amending a commit:

Git amend allows adjusting the last commit. For example you can change the commit message or add another modification.

The Git Staging view allows you to perform the Git amend command via the highlighted button in the following screenshot.

Creating and switching branches in TimeStorm

Right-click your project and select Team → Switch To → New Branch to create new branches or to switch between existing branches as shown below.

Enter branch name and click on Finish button to create the branch as shown below.

Starting a merge operation in TimeStorm:

TimeStorm supports merging of branches to add the changes committed on one branch into another branch.

Checkout the branch into which you want to merge the changes into and select your project and Team → Merge to start the merge dialog.

Select a branch or tag to merge into master branch and Merge button as shown below.

Rebasing a branch into another branch:

The Git Repositories view allows you to rebase your current checkout branch into another branch.

Right-click on a repository node and select Rebase as depicted in the following screenshot.

In the following dialog you can select the branch onto which you want to rebase.

If the rebase was successful a dialog is shown. You have to resolve rebase conflicts if they occur. After resolving them, select Rebase → Continue.

If you want to skip the conflicting commit and continue with the rebase operation use Rebase → Skip.

To cancel the rebase operation select Rebase → Abort.

Solving conflicts created by merge, rebase or other operations:

If during a Git operation, two changes are conflicting, you have to solve these conflicts manually by following the https://git-scm.com/docs/git-mergetool.

Git reset and Git reflog:

The History view allows you to reset your current branch to a commit. Right-click on a certain commit and select Reset and the reset mode you would like to use.

Selecting individual commits via git cherry-pick:

In the History view, you can cherry-pick a commit via the context menu. Cherry-pick allows you to move selected changes described by a commit to another branch.

Let's assume the following situation, in which you would like to remove the "Bad commit" from the history described by the ‘devl’ branch.

You could start with a hard reset of the branch to origin/devl. This will move the devl branch pointer to the commit described by origin/devl. The Good and the bad commit are not reachable anymore by the ‘devl’ branch.

To re-apply the changes by the "Good commit", cherry-pick the good commit.

For more information, please follow the https://wiki.eclipse.org/EGit/User_Guide.