Easy ways to identify different branches when using Eclipse

When working on different branches in Eclipse, you’ll often find yourself wondering if you’re working in the right workspace for the right branch. This is especially an issue if you have multiple Eclipse instances open and you’re working on different branches of the same codebase, eg. dev, fix, release and feature branches.

There are a number of features in Eclipse that can help you distinguish which window belongs to which branch, including naming your workspace, naming perspectives and colouring your window.

Most features don’t show you the actual branch (ie. its name as it exists in the SCM) but they enable you to manually mark a workspace as belonging to a branch.

Display the workspace name in the window title bar

The easiest way to identify which branch you’re working on, is to name the workspace to make the name appear in the window title bar.

To change the workspace name:

  1. Go to Window > Preferences > General > Workspace.
  2. Change the setting Workspace name (shown in window title) to the name of your branch or whatever identifying name you like.
  3. Click Ok.

Workspace_name_preference

Your window title bar should now contain the name you entered as the first bit.

Workspace_name_in_title_bar

Display the workspace path at the end of the window title bar

Eclipse can also display the workspace path in the window title bar. This is done via a command line argument. The easiest way to enable this is to run Eclipse with -showlocation:

c:\eclipse> eclipse -showlocation

The workspace path will now appear in the title bar at the end of the title.

Workspace_path_in_title_bar

It’s a bit less useful than naming your workspace as your taskbar may not have enough space to display the path so you can’t easily identify the right window in the taskbar. And sometimes the path doesn’t identify the actual branch.

You can also provide a workspace name at the end, eg. eclipse -showlocation ReleaseBranch. To make the -showlocation take effect every time you invoke Eclipse, you can add it to your eclipse.ini file as a command line argument (above the -vmargs).

Change editor and view colours

You can completely customise the colours of your Eclipse editors and views. This also provides a useful way of distinguishing between two different branches, especially if the window title bar is a bit too subtle for you.

To change the colours, I’d recommend installing the Eclipse Color Theme plugin and choosing one of the themes from the associated site.

To change the colours manually, you can go to Window > Preferences > General > Appearance > Colors and Fonts and change the colours from there. You will have to spend some time fiddling around with the different components though, so using existing themes or importing existing preferences is recommended.

Other ways to identify the branch

Here are some more ways to identify which branch you’re working on, although some may not be as immediately obvious as the ones above:

Related Tips

Support Eclipse On E

2 thoughts on “Easy ways to identify different branches when using Eclipse

    • Thanks kon. Yes, that definitely helps but it’s just a shame that you first have to open the package explorer to see it. Useful nonetheless.