Reputation:
Since git moved my project to be under its own /git/ directory, I have lost the ease of use of things like right clicking in the project and choosing things like 'New' -> 'Java Class'. The source folder, Package and Superclass fields are blank by default when I try this from the Git Repositories View, whereas in Package Explorer View I would still be able to this, except git moves your project out from there. (Now that I write it out, could this be a path issue?)
Adding pictures to help explain :
This is what I get when I right click in an attempt to add a class in the git version of my project:
This is what I get when I attempt to add a class in the project explorer version of my project:
Upvotes: 2
Views: 6536
Reputation: 3567
Adding new files from eclipse project to your git repo is quite simple with EGIT plugin. Egit comes pre-installed in every Eclipse installation that was shipped for Java EE and you can install from eclipse market place if you don't alraedy have it. To Add a new file to your git repo, follow the following steps
Right click the new file and hover the pointer on Team, then click Add To Index. Once it is added to index, it is ready for committing.
Right click on the project, select Team.
Upvotes: 0
Reputation: 1
If you are using Linux then you can add any file by following these simple steps :
Upvotes: 0
Reputation: 1323553
When setting up Git Repositories with EGit, there are two recommendations for the creation of "productive" (as opposed for "playground") Repositories:
- Don't create the Repository within the Eclipse workspace:
- Be careful when cloning or creating a Repository
- Make sure to use the Git Sharing Wizard correctly
- Don't create a Repository with an Eclipse project as root
- Make sure to use the Git Sharing Wizard correctly
The first one happens when you specify a workspace folder during cloning or creation of a Repository.
Both of the above will happen when you use the Git Sharing Wizard from an Eclipse project that you have created manually in your workspace without taking precautions (the wizard has been fixed in the latest version).
This is compliant with the workaround found by the OP jason:
I did not create the repo in the Eclipse workspace (its in
/git/
).
I did find a 'workaround' of sorts.Instead of importing a project from the workspace:
- create the repo in
/git/
first,- then create a new project in there.
This made it so Package Explorer was able to do its thing, and Git Repo View was able to do its thing to
Upvotes: 1