Difference between revisions of "Git for User Assistance Developers"
|Line 32:||Line 32:|
== Creating Patches ==
== Creating Patches ==
Latest revision as of 13:52, 25 August 2011
The Eclipse User Assistance source repository will be in Git starting late August 2011.
Getting Started with Git
If you are not familiar with Git you should start by reading up on it.
Pro Git is an excellent book which describes the concepts behind Git and how to use Git from the command line. It does not cover EGit, the Eclipse Git integration.
EGit is the home page for the EGit project. EGit provides the UI for working with Git in Eclipse.
Configuring Eclipse to Use Git
EGit is not part of the Eclipse SDK download so you will need to add it yourself. This can be done using the update manager. If you are using a recent nightly or integration build http://download.eclipse.org/egit/updates-nightly/ is the place to get the latest version of EGit. For Eclipse 3.7 you can install Git from the Indigo site, in the Collaboration category.
When you work with Git most of the work is done in a local copy of the repository. The only times you will need to access the remote serve are to clone, pull or push. Cloning a repository creates a local copy of the entire repository. A pull operation will make your clone up to date by pulling from the server any changes made since you last pulled the sources. A push operation, which requires commit rights will update the remote repository with changes you have made in your local repository.
Cloning Git Repositories
The next step is to create a local repository by cloning the master repository on eclipse.org. This is done by opening the Git Repositories view and selecting "Clone a Repository" from the view drop down menu.
If you are a committer you can use this path to access the repositories: ssh://email@example.com/gitroot/platform/eclipse.platform.ua.git
If you do not have commit rights and want to work anonymously use git://git.eclipse.org/gitroot/platform/eclipse.platform.ua.git. You will not be able to push changes to the remote repository but you can commit to your local repository.
Loading projects from Git into Your Workspace
After cloning the repository you will want to check out some projects into your workspace. This is accomplished using the menu item File/Import/Projects from Git. Select eclipse.platform.ua as the repository in the first screen. Import the projects you want and you now have the sources from Git in your workspace.
Working with branches
The eclipse projects in Git contain a number of branches. "master" is used for new development. For maintenance releases the branches have names like R3_7_maintenance. If you look in the Git Repositories view you can see that there are both local branches and remote tracking branches. Any work you do should be performed in local branches. If you work in more than one branch it is easiest to have one workspace per branch. You can switch to another branch by selecting a project in the project explorer and using the context menu item Team/Switch To/New Branch ... and setting the source ref to ref/remotes/origin/<Branch Name> .
To create a patch you first need to commit your changes to a local branch. Make sure you commit all of the files in a single commit operation. Then select one of the files you have changed in the package explorer and select the context menu item Team/Show In History. The history view will open. Select the top line in the history view, which should be the change you just made, right click and select Create Patch ... This will open a two page wizard. On the second page uncheck the box which says "Export in Git Format".