Git for Committers
- 1 Background
- 2 Setting up git
- 3 Reference
- 4 Using the EGit integration
- 5 Known git repositories for Eclipse projects
- 6 Meetings and Resources
- 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
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://github.com/jamesblackburn/eclipse-core-resources-tests.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.
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 :pserver:firstname.lastname@example.org:/cvsroot/eclipse -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.
git branch -a
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!).
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 http://github.com/jamesblackburn/misc/tree/master/scripts/eclipse-sync driven by the sync.sh script This cvsimports the projects from the Eclipse repository and pushes selected branhces (HEAD and 3_4) to github.
Git in 20 Commands http://www.kernel.org/pub/software/scm/git/docs/everyday.html
Git for Computer Scientists http://eagain.net/articles/git-for-computer-scientists/
Git Documentation home http://git-scm.com/documentation
When importing an existing repository
- How to set up a local git repository as a committer
- How to import from Eclipse CVS
- Any additional notes to that?
- Important Commandline Commands to push etc
- Something along the lines of Ketan's blog for Mercurial
- Known Issues and Gotchas
- Initially pulling from CVS into a repo puts HEAVY load on the Eclipse CVS server ... better clone an existing git repo if available (Can be used as a a form of a torrent, it is possible to pull from someone else I know, and sync with eclipse servers, they're all the same repositories after all)
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
- Core Resources: http://github.com/jamesblackburn/eclipse-core-resources
- Core Resources Tests: http://github.com/jamesblackburn/eclipse-core-resources-tests
- UI IDE : http://github.com/jamesblackburn/eclipse-ui-ide