Eclipse EGit VCS Plugin

This page is for Eclipse users who are trying to master using EGit in the Robot Lab workflow.

Documentationhttp://wiki.eclipse.org/EGit/User_Guide#Getting_Started

Referencehttp://wiki.eclipse.org/EGit/User_Guide#Reference

INSTALL ECLIPSE NEON

This article assumes using Eclipse Neon.1 which has built in Gradle and Git support. https://eclipse.org/downloads/

Keep Plugins Up To Date

NOTICE

 We DO NOT USE the Marketplace for plugins anymore. Please reinstall your plugins from the update sites here: Installing plugins in Eclipse

You want to make sure to keep Buildship and EGit up to date, including Gitflow support.

Uninstall Old Plugins

Configuration

Ensure autocrlf=false.

DO NOT SET 'core.eol'!

I'm not sure how important these cache options are, but these are the settings of the author.

Make sure you are refreshing using native hooks, polling, and on access. Ensure UTF-8 encoding and Unix line endings.

Setting Default Pull Method to 'git pull --rebase'

ECLIPSE




Synchronizing

A fully up to date workspace with no incoming or local changes looks like this:

ViewDescription
SynchronizeViews the diffs between two branches, in most cases, your local develop and remote develop. You have the option to include also your uncommitted changes.
Git StagingWhere you make commits. Add unstaged changes to index (staged), enter a commit message and commit. Careful, commit and push will send your commit to the remote!
Git RepositoriesShows all the repositories you have cloned locally. Use this window to push and pull from individual repos, create branches, and other advanced Git operations.
History

Shows a history of all the commits that changed the selected file.

Rebase InteractiveHelps you step through commits as you rebase them onto the remote branch.

Setting Up Synchronize

Set all Destinations.

Don't forget to check 'Include local uncommitted changes in comparison'.

Then, check 'Java Workspace':

Here is a reference for what the little icons mean.

Setting up History

Make sure to check 'Show All Branches and Tags':

Making a Commit

We make a change to FileTools.java:

Then this happened:

You can see the Java file changed in the project, and the Git commit process has been initiated. To proceed add FileTools to Index.

 OR  OR Drag it into Staged Changes.

And now the change is staged (I have also added a commit message):

 Click commit.

Our commit is now ready:

Quick Commit

To perform a quicker style commit, right click and select Commit on a changed file.

Add and commit message a check or un-check the files you want the commit to contain. You also have the option to commit and push in one click.

Doing a Push

There are two ways to push:

 Push to a single repository in 'Git Respositories' view.

 DO NOT USE THIS PUSH BUTTON. It is very dangerous and could push more than you want.

Undo/Reset/Overwrite a Change

Doing a Fast-Forward Fetch and Rebase

Rebase on origin/develop:

Doing a Fast-Forward Pull

 Pull from all repositories.

Doing a Pull With Rebase

 First, you need to set Pull to 'Rebase' mode.

Do a pull. If you have local commits, you see this:

 Upon pulling, you get Result: Stopped.

The repo will show 'Rebase w/ merge'.

Resolve the conflicts in your file and mark them as Merged.

 Continue rebase.

Doing a Reset

Say you make some changes that you want to reset before you have pushed them.

Here I have made a commit and then made some additional changes to the same file:

In Git Repositories view we Reset:

Two things are important. Reset to origin/develop and select Mixed to not overwrite your working tree. Select Hard to overwrite all local changes.

Result:

Stashing Changes

If you need to pull but you have conflicts, stash your changes, pull, then apply stashed changes. This is essentially a simplified rebase.

Advanced Operations

Doing a Squash

Find the commit below any commits you would like to squash in your local repository's history:

Select 'Rebase Interactive':

Find your 'Rebase Interactive' view:

Select 'Squash' on the latest commit ('Pick' on the other):

Click 'Start':

Rewrite your commit message:

Click okay:

Bugs and Workarounds

Items get stuck in Synchronize View

Sometime conflicting additions or conflicting moves that don't actual exist. will get stuck in the Synchronize View. The only way the flush them is to delete the Synchronization and make a new one.

Imported Gradle Projects Aren't Detected As Git Projects

In Git Repositories view, import local repositories cloned by Hephaestus.