Want to show your appreciation? Please to my charity.

Wednesday, January 18, 2012

EGit Bootstrap

Note: Recently I wrote a series development bootstrap documents for our new Java project using Eclipse as primary development tool. Maybe useful to others.

Introduction

This page assumes you have basic understanding of Git. Please read Git Installation and Configuration to get familiar with Git version control system.

Installation

Please refer to the Git Integration (EGit) section of Eclipse and Common Plugin Installation page.

Configuration

  1. In Eclipse, go to menu Windows -> Preferences. Enter the “git” as filter text.
  2. Select "Team->Git->Commit Dialog", uncheck Hard-wrap commit message and click on "Apply" button.
    egit-config-commit
  3. Select "Team->Git->Configuration". Add or change the key/value pairs accordingly (see warning for autocrlf value). Then click "Apply" button.
    Warning
    The value for core.autocrlf is different for different operating system. Please refer to EOL Handling section of Git Installation and Configuration page.

    egit-configuration

  4. If your have EGit 1.2 and above, select "Team->Git->Projects" and check "Auto share projects located in a git repository" option. Then click "Apply" button. If you don't enable this option, you'll need to manually share your projects .
    egit-config-share
  5. Replace text filter with "mylyn" and select "Mylyn->Team", change the "Commit Comment Template" to
     ${connector.task.prefix} ${task.key}: ${task.description}

    mylyn-config-commit

  6. Click "OK" to save the setting and close window.

Clone Repository

  1. Open “Git Repositories” window.
    Show View For detailed instructions on how to show feature window, please refer to Access Feature Window section of Eclipse and Common Plugin Installation.
  2. Pull down Git Repository menu and click on select “Clone a Repository”.
    Tip: You can also use “Add a Repository” if you have already cloned repository using other Git client.

    egit-repo-menu

  3. Enter the source repository URI to clone. If you have saved password to netrc, you don’t need to enter password here. Otherwise you must enter authentication information and optionally save it to the secure store. Click "Next >" to move on.
    egit-clone-source
  4. Select all branch and click “Next >” button to continue.
    egit-clone-branch
  5. Enter (or Browse to) the local directory path and click “Finish” button.
    egit-clone-local

Share Project

You must share your project before you can use EGit to commit, pull and push changes. This section assumes that your projects are already in a Git repository. Follow the instructions below to enable Git operations for those projects.

  1. Go to "Project Explorer" window.
    Show View For detailed instructions on how to show feature window, please refer to Access Feature Window section of Eclipse and Common Plugin Installation.
  2. Select projects that you want to enable Git operations, then right click on one of them.
  3. Select the Team->Share Project content menu item.
    egit-share-project-menu
  4. Select Git repository type and continue.
    egit-share-project-type
  5. Check "Use or create repository in parent folder or project" checkbox, leave all projects selected and click on "Finish" button.
    egit-share-project-repo
  6. Now the project context menu "Team" is populated with EGit menu items.
    egit-full-context-menu

No comments:

Post a Comment