I just added repository A to my Git perspective in Eclipse (which also instanced a local Git repository under some path) and can now see the working tree. Now how do I work on the files in the package explorer?
From what I've seen I have to use "import projects" - what does this do? My Eclipse workspace seems to be empty, while made changes will all display in the git repository.
Also, how do I work with multiple repositories and how do I switch between them? When I try to "import projects" from repository B I get the message that Some or all projects cannot be imported because they already exist in the workspace
The issue here is that Eclipse maintains its own file system representation that includes projects. This was required historically to support incremental compilers, even if the file system is not capable of sending notifications.
The Import projects option you have seen relates to importing projects from a git repository into the Eclipse file system; adding the repository to Eclipse allows Eclipse to know about the repository, and execute repository operations (e.g. fetch, commit, push).
About why doesn't the project import work, the Eclipse file system contains a set of top-level projects (each can be either in the workspace folder or somewhere on the disk, e.g. in a git repository); however, it is not possible to have two projects with the same name in the same workspace.
If you want to open the "same" project from two repositories (e.g. two development branches), you have to rename them not to have a common name. This name is stored in a .project file in the project root (or if none exists, it will be derived); you can use a refactor operation to change the project names. After that, you can import both projects into your Eclipse workspace.
Related
I just added repository A to my Git perspective in Eclipse (which also instanced a local Git repository under some path) and can now see the working tree. Now how do I work on the files in the package explorer?
From what I've seen I have to use "import projects" - what does this do? My Eclipse workspace seems to be empty, while made changes will all display in the git repository.
Also, how do I work with multiple repositories and how do I switch between them? When I try to "import projects" from repository B I get the message that Some or all projects cannot be imported because they already exist in the workspace
The issue here is that Eclipse maintains its own file system representation that includes projects. This was required historically to support incremental compilers, even if the file system is not capable of sending notifications.
The Import projects option you have seen relates to importing projects from a git repository into the Eclipse file system; adding the repository to Eclipse allows Eclipse to know about the repository, and execute repository operations (e.g. fetch, commit, push).
About why doesn't the project import work, the Eclipse file system contains a set of top-level projects (each can be either in the workspace folder or somewhere on the disk, e.g. in a git repository); however, it is not possible to have two projects with the same name in the same workspace.
If you want to open the "same" project from two repositories (e.g. two development branches), you have to rename them not to have a common name. This name is stored in a .project file in the project root (or if none exists, it will be derived); you can use a refactor operation to change the project names. After that, you can import both projects into your Eclipse workspace.
I have an Eclipse workspace in ~/EclipseWorkspaces/Sabia with a number of projects under Ubuntu 15.10. The source code for these projects resides in a Git repository at ~/GitRepositories/Sabia.
I can find no way to tell Eclipse in the Pydev Package Explorer that the projects use the Git Repository. If I try to use Team->Share, the system rejects the Git repository because a directory for each project exists in the repository and Eclipse is trying to move the project to the repository which already has a project directory.
I tried the suggestion by Michal Grzejszczak but unfortunately it does not work because the Git Repository does not contain complete projects, only the source trees for the projects. The Eclipse metadata is in /EclipseWorkspaces, not in the Git Repository so import projects on the Git Repository perspective does not work.
In addition when I tried to delete the projects I got the following error message:
AppFrame (One of my projects) contains resources that are not in sync with /home/jonathan/Dropbox/EclipseWorkspaces/Sabia/AppFrame. Press 'Continue' to force delete`
for half of my projects.
Unfortunately the message gives no more information and I have no idea what kind of problem might actually exist. I am not prepared to delete any flawed projects until I have corrected whatever was wrong.
How can I tell the Eclipse Pydev Package Explorer where the Git repository resides?
You need to first add this repository to Git repositories view in Eclipse. Then remove these project from workspace, but without deleting contents and then the most crucial part import them back with "Import projects..." from context menu after right clicking Working tree of the repo in Git repositories view.
That should make your projects managed by Git.
If I try to put repository inside project folder
it warns it is not recommended to put git repository inside workspace.
If I try to create intermediate folder
it swears "overlaps the location of another project" at the stage of creating new project.
And if I try to create project inside workspace and repository outside, it moves the project also outside of workspace
So, the only way to use Git under Eclipse it totally abandon workspace?
If you choose the last solution you present, to deal with git and Eclipse, you will not abandon workspace, all your code will remain into your Project Workspace but you will get an additionnal folder somewhere else containing your same code, versioned, a local git repository. By choosing this solution, you can only version some parts of your project and you also avoid some possible conflicts that can arise when versioning your workspace project folder. You can also have a cleaner view of your code if you want it without eclipse metadata and do some complex git tasks on the commandline in this separate folder.
I'm more or less a git newbie, trying to get a good Setup to work in Eclipse with egit. I'm running Kepler with latest updates.
Originally I Setup the structure inside the Workspace Directory.
+Workspace/.git
+Workspace/TheProject
Using this Setup (admittedly with Juno) commits were taking forever. For this and other reasons I'd like to move git outside the Workspace Directory, outside eclipse in a parallel Directory.
+OtherDirectory/.git
+Workspace/TheProject
But I'm not getting very far. There seems to be no easy way to split the EXISTING git to another Location without having the Project move there too(!?)
I've tried e.g. Cloning the existing git (in the git repository perspective) and having it Import the Project in the same move.
I've tried just Cloning the existing git, without selection of "Import Project" at the same time.
Then I right clicked the cloned repository and went through the Import Existing Project dialog. I don't get a Chance to say where the Project should be loaded to.
In both cases the Project Ends up in the same Directory as the .git Directory (now outside the Workspace)
+OtherDirectory/.git
+OtherDirectory/TheProject
and not as I wish - to have the Project in the Workspace Directory.
This must be possible (?), but how?
Simply copy the .classpath and .project from Workspace/TheProject or OtherDirectory/TheProject, to otherDirectory (where the .git folder is).
Then import your project into the workspace, as in "Eclipse - Import an existing project?"
Everything will remain in OtherDirectory/ (outside your Eclipse workspace folder), but will be visible in your Eclipse workspace.
I am trying to import an existing git repository as an eclipse project. The repository is stored in the location ~/src/repo_dir, and ~/src/ is my eclipse workspace directory.
If I use the sequence of menu operations:
File --> Import --> Git --> Projects from Git --> Local --> (Select my repo)
--> "Import as General Project"
I get the error:
/Users/me/src/repo_dir overlaps the location of another project: 'repo_dir'
and I can't import the project. It seems to be because Egit does not want the original repo that is being imported to already be in the workspace. However, if I then move the repo_dir out of the workspace directory ~/src/, and then import the project via the method above, it doesn't copy the contents to the workspace directory, so now my files live somewhere else, which is undesirable. The only workaround that I have found is to move the repo out of ~/src, import it, delete the resulting project, move the repo back into ~/src, and then import it with git as an 'Existing project.' Does anyone know of a cleaner way to handle this?
There are two different issues here:
Git handles a selected folder in your computer as a repository - and also stores some git-related metadata in it.
Eclipse handles a selected folder in your computer as your workspace. It stores that Eclipse configuration files (not meant to be shared), and even worse, it expects a single-level folder hierarchy for projects.
This means, putting a Git repository inside the workspace might cause a lot of unwanted issues - so I do not recommend this way (even if by some hack it is workable). However, if you want to organize all stuff related to an Eclipse workspace, you could create a folder structure as this:
eclipse-stuff
workspace
git
git-repo1
git-repo2
The workspace folder is given to Eclipse as the workspace folder, while git-repo1 and git-repo2 are your Git repositories.
On the other hand, I like to put all my git repositories into a common folder, regardless of the Eclipse workspace I use them in, but if you want to organize contents, this might not be enough for you.
Had this problem with Eclipse Kepler.
End up with installing Eclipse Mars and import the new project in another workspace.(Luna will also work fine)
If you need to work on current projects and set up environment for the coming one...