This workflow is part of my DVCS blog series. If you don’t understand some steps, please read the first parts of the series.
The goal: a single project from Workspace with Git Repository using EGit
Most times your repositories will contain more then one project. How to do this is explained here for EGit and here for HgEclipse. But sometimes you only want to put a single project under control of a DVCS to use branching etc. This workflow will demonstrate how easy you can share a single project.
The short story:
- Share one project
- Share the project (create Repository)
- Add ressources to Repository
- Commit to Repository
- You’re done: a project in your workspace shares a Repository
the long story:
1. Share one project
1.1 Share the project (create repository)
Go to your Project from Package Explorer and right-click “Team -> Share project…“:
select “Git” as Provider, as next select the line and click “Create Repository“:
and hit “Finish“.
Now the Repository is created and the project decorated as “under version control”:
Ressources not yet in your repository are marked with a question mark, the project itself is marked as “master”.
1.3 Add ressources to Repository
As next we have to add the missing ressources to the repository: “Team -> Add to Version Control…”
then the Ressources are decorated as “Added, but not committed”:
Unfortunately at the moment there are two steps neccesary: add and then commit, but there’s discussion to combine this: Bugzilla 303373.
1.4 Commit to Repository
“Team -> Commit…” shows this dialog, please enter a message:
Hit “Commit” and your project is under Version Control.
2. You’re done: a project in your workspace shares a Repository
We can’t control the repository from a Git View, but if we take a look at the file system, we can see that the repository is created successfully into your Project – directory:
To solve the same task using Mercurial /HgEclipse: here’s the workflow.
This workflow is part of my DVCS blog series – an overview of all workflows can be found here.