Jump to: navigation, search

Difference between revisions of "Git for Committers"

(Setting up git: Add cvsimport steps)
m (Setting up git: Pull Referenes up)
Line 23: Line 23:
 
=== Tracking only your own changes ===
 
=== 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.
 
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: <code> git init; git add . ; git commit ; </code> Git will then start tracking changes from this point onwards.
+
Turn any directory into a versioned repository with the sequence: <code> git init; git add . ; git commit ; </code> Git will then start tracking changes from this point onwards.
  
  
Line 56: Line 56:
 
This cvsimports the projects from the Eclipse repository and pushes selected branhces (HEAD and 3_4) to github.
 
This cvsimports the projects from the Eclipse repository and pushes selected branhces (HEAD and 3_4) to github.
  
=== Reference ===
+
= Reference =
 
Git in 20 Commands
 
Git in 20 Commands
 
http://www.kernel.org/pub/software/scm/git/docs/everyday.html
 
http://www.kernel.org/pub/software/scm/git/docs/everyday.html

Revision as of 18:39, 9 March 2009

Background

  • 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

Easy-setup

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:anonymous@dev.eclipse.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.

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 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.

Reference

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

Using the EGit integration

Contributing to EGit

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

 http://code.google.com/p/egit/

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