Skip to main content
Jump to: navigation, search

Git for Committers

Revision as of 18:35, 9 March 2009 by (Talk | contribs) (Setting up git: Add cvsimport steps)


  • bug 257706 Host a git repository on Eclipse Foundation servers, support git as the repository of Eclipse projects
    • bug 257706#c63 Mike M. on potential problems with git at the Foundation
  • bug 249745 Eclipse Repository Best Practices
  • EGit/Proposal

Setting up git


Has someone already imported the repository for you? If so clone or fork theirs! (See Known Git Repositories for Eclipse Projects.)

Cloning a repository locally is as easy as: git clone <repo_url> my_checkout_dir_name e.g.: git clone git:// org.eclipse.core.tests.resources

Importing a repo

The process of creating a repository is the same whether you're an existing committer or not.

Tracking only your own changes

If you're only interested in your own changes and/or don't care about importing existing commit history from a legacy repository, you can just tell git to start tracking changes in a specific directory tree. To turn any directory into a versioned repository with the sequence: git init; git add . ; git commit ; Git will then start tracking changes from this point onwards.

Migrating from CVS

To import and track changes from an Eclipse CVS server, for example, you would do something like the following:

git cvsimport -v -C eclipse-core-resources -d -r cvs org.eclipse.core.resources

This commands says: import the org.eclipse.core.resources module into a git repository in the directory eclipse-core-resources. The -r switch says to store the loaded repository data under the 'cvs' remote. A remote is like a git branch except you _never_ checkout a remote directly. You'll create your own branches based on remote versions. The remotes must be kept clean so that when you next run cvsimport, or pull changes from others, they apply cleanly.

With that one command you now have a fully-fledged repository waiting for you.

cd eclipse-core-resources git branch -a git log

branch -a will show all the branches. You'll see that you're currently sitting in master which has been automatically created as a clone of cvs/master. git log shows you the most recent commits into the cvs repository. You'll also see that cvs/* has all the upstream branches (which is a lot!).

Staying fresh

When you next want to update sync your repository, run the git cvsimport command again. You might want to pass the _-i_ switch to cvsimport. This prevents git from automatically merging changes from HEAD into your master branch which you may want to do if you have uncommitted local changes.

You can see changes made in a remote with git log <remote_name>/<branch_name>.

Examples: Some scripts which track Eclipse & e4 core.resources and CDT take a look at driven by the script This cvsimports the projects from the Eclipse repository and pushes selected branhces (HEAD and 3_4) to github.


Git in 20 Commands

Git for Computer Scientists

Git Documentation home

When importing an existing repository

Using the EGit integration

Contributing to EGit

If you want to get involved with EGit, please see our Google Code project site:

Known open issues are listed here, along with the clone URL for the Git repository containing the project's code. Loading it into Eclipse is as simple as importing the existing projects from the checked-out repository. Please see SUBMITTING_PATCHES in the top level directory for information on how to send contributions in.

Known git repositories for Eclipse projects

Platform Plugins

Meetings and Resources

Back to the top