EGit deleted my workspaces - eclipse

So I need some serious help. I was looking into using EGit in eclipse. I created a test project and Team > share to a local git repository. I than committed the project to the repository. Cool I thought, but I didnt need this repository so I deleted it. Than my entire Project Explorer went empty and my Folder that contained all my workspaces is GONE. I am kind of freaking out right now, anyone know what to do?

When you select Team > share Project, EGit has to move all the files of the selected project(s) to the Git repository that you selected. EGit has to to that because you can't track files with git that aren't located inside the repository.
However, this makes your workspace look empty. The whole project seems to be gone. In fact, it isnt. In some config file is noted that the project has been moved to another location.
If you delete your repository, you also delete the files in it (it is a normal directory, remember that!). That means, if you really deleted your repository and did not just removed the link to eclipse so that it doesn't display the repo anymore.
Other than that, egit doen't touch anything else. It will only move the projects that you selected, and it will move it only to the location you told egit (the selected repository).
If you are sure that you lost projects you didn't select and/or one or more completly unrelated workspaces by doing what you have written above, than i suspect you found a bug as heavy as this one: https://github.com/MrMEEE/bumblebee-Old-and-abbandoned/commit/a047be85247755cdbe0acce6f1dafc8beb84f2ac

Related

Commit Folder From Local Directory to Online Using SVN

I'm completely new to subversion and I'm unsure how to add and commit a Java Project to an online repository using svn. The goal is to move the important folders in the project including the src, package, and class. I've accessed the online repo and I (assume) I have it as a working copy. When I try to svn add the local project folders however, I am told it is not a working copy. How do I fix this? Is there a way I can make my workspace be the online repo directly? Or do I just copy the folder somehow? I'm using Cygwin and Eclipse.
To add your project to svn you can do it this way:
Right click on your project and select: Team / Share Project...
Select SVN
Select Use Existing Repository Location
Browse to the location you would like your project to reside: typically .../trunk
Click OK and finish
This should have committed your project to SVN. Regarding your question about your entire workspace being the online repo. with each of your individual projects connected to SVN just like I detailed above, you will be able to commit and update your local projects into and from SVN without any issues.

Why can't I use my workspace if its a Git repo with eclipse

I have a git repo that has a lot of test scripts in it. I started by setting this repo as my "workspace" in eclipse so I could make changes directly with eclipse and then just push them up to bitbucket once they are done.
Eclipse wont let me do this, I cant see anything in my work space and when I try to import the local repo to the workspace it tells me "Can't import project MavenTest from an existing workspace folder"
This doesn't make sense to me since I would have to make a separate workspace from my repo and then do the work into the workspace and manually copy it to the local repo and then push it up to bitbucket. Also pulling everything down will be a pain too since I'll have to copy any changes to my workspace. I defeats the whole purpose of version control.
Can someone please explain to me what I am doing wrong? I just want to work, push and pull all in the same directory.
Eclipse expects everything at the top level of its workspace directory to be a project, or otherwise content written by a plug-in through Eclipse's APIs. Any other content in the repository will be unusable and not importable as its location already overlaps the location of the workspace.
I would have to make a separate workspace from my repo and then do the work into the workspace and manually copy it to the local repo and then push it up to bitbucket.
Wrong. You're under the misconception that everything shown in the workspace has to physically live under the workspace directory, which is very untrue. They don't have to be there, they don't even have to be physical files.
Typically you will make Eclipse aware of the local clone using its Git Repositories View, and then use the view's context menus to import content from the repository's working directory as projects in the workspace (or using a Maven wizard provided through M2E). This import will not duplicate anything. You will still have one canonical location for your sources: your repository.
https://wiki.eclipse.org/EGit/User_Guide#Creating_Repositories

How to add to git index with JBoss Tools

I've created a new project on OpenShift and cloned it locally. But now i'm having problems adding new files and folders to git index. Right click on the new folder (with files and subfolders) in project explorer and choosing Team -> Add to Index, changes nothing. And if i try to commit, Eclipse says that there aren't any changes... (If i only update existing files, everything seems to be fine).
What could be the problem?
Make sure that you have the "Git Staging" view open, and right click on the file in your Unstaged Changes and Select "Add to Index", also make sure that the file is not empty, it did not show up as a staged file until after i added some content to it, even after I had added the file. (Can't add empty files or directories to git with EGit maybe?)
this sounds like EGit missing new files. I'd love to know a bit more about your setup:
Where did you clone to, where is your Eclipse workspace?
To make sure your git setup is right I suggest that you do the same with the git command line:
cd [git-repo]
git status
Git status should list the new files and tell us that they're not added yet. If they get listed, then we know that your git is set up right and we can get back to Eclipse to try to figure out what's wrong with it.
Found out what the problem was (kind of stupid though). The folder that contained new content was listed in .gitignore ... but that file isn't accessible through eclipse, i had to look it up on filesystem. I also don't have a clue, how that line came to .gitignore...
Well, that's it...

Egit Eclipse best practises (play framework 2,.0) project

Im very new to git ingeneral, egit and github.
The problem:
Lets say I have a project for eclipse in c:/username/workspace name "Test". So I versioned it and pushed it up to github.
Now I can see all my Files in github under the directory "Test" in github. In example /src. The "Test" directory is not versioned. only the name of the repository is "Test".
My next step was to delete my local files and fetch my project again(For testing). After that I had to import my project again (but I had to use the new project wizard) over the egit view. Unluckily also the wrong scala version was detected. (Was a play framework project). So I had a big exclamation mark on the project view.
My questions:
What is the best practice to oush a project to github so everyone can participate? Everything under the project folder? Obviously some information got lost through the process.
How can I prevent to generate a new project every time someone clones the repository?
What about best practices for using git inside the workspace. Eclipse warned not to put the project inside the workspace.
Im coming from a subversion background :/. Maybe a general missunderstanding.
Thanks in advance
Switching from SVN to Git in an Eclipse environment can take some getting use to. (I'm still getting accustomed to it myself.) Keep in mind the difference between the role of the .git folder and the .svn folders for Git and SVN respectively. There is a .svn folder at every folder level in the working copy. There is no .svn folder in the traditional Eclipse workspace root. The "source controlled things" are subdirectories of the workspace, not the workspace itself. This is generally good because the workspace contains desktop specific settings that one generally doesn't want shared (much of it in the .metadata directory).
With Git, there is only one .git folder that contains everything. The first impulse is to do a
git init
at the workspace level. This would make the subfolders (the Eclipse projects) eligible for source control. But wait, so is .metadata. Of course you can ignore it. But you may have to ignore lots of other folders (projects) that you do not want source controlled. Of course, the .gitignore should be included. But others will have different files to ignore.
It turns out that its easier to use Git with Eclipse if you place the .git folder and its sibling source controlled folders (Eclipse projects) someplace else besides the workspace root. Your view in Eclipse doesn't change. You still see all your projects, both the Git-controlled and the SVN controlled and ones not shared at all. But underneath in the filesystem, the Git-controlled folders will be somewhere else. This is what EGit prefers.
On my desktop, I have a workspaces directory for most of my Eclipse workspaces. Now that I use EGit, I also have an egit directory where I keep the local EGit repositories. The Eclipse workspaces that share using EGit reference a subdirectory of egit. It's from these local Git repositories that one pushes and pulls from GitHub.
Sorry for the length. I got a bit carried away.

Eclipse Subversive plugin: Why can't I create this branch?

I recently switched from Subclipse to Subversive for SVN integration in Eclipse, and I'm having trouble creating a branch of my source code.
I've tried a few different variations of my method, but they all led me to the same roadblock. Basically, here's what I'm trying to do.
Navigator pane
Right-click on project folder (want to branch the whole thing)
Team > Branch
In the Location field, browse to select the /branches folder in my repository
Add the branch name to the path field, i.e. "/testbranch" (not pictured)
The dialog then looks like this, and I can't continue.
http://img820.imageshack.us/img820/1011/branchingfail.png
What am I doing wrong here? Why can't I create this branch? If nothing else, can it at least be confirmed that I'm following the right process, and it's something about my environment or configuration that's stopping the branch from being created?
I found that SVN is very particular with the SVN connectors. If you connected and downloaded SVN code with one connector and then switched to a different connector when you started using Subversive, you'll definitely have problems.
I've had unexplained Subversive problems in the past and they've almost always tracked back to different connector usage. The solution for me was to reset all of my local SVN code. I deleted everything local and rechecked out all of my code. Everything appeared to be fine after that.
I hope this helps.
I don't consider this a proper solution, but it's at least got me working again. Instead of running a branch operation, I created a new folder inside my branches folder, and then copied the contents of the trunk folder into it. I was then able to switch to my new "branch".
Make sure you do not have any uncommited changes, and then do a Team>cleanup. Also make sure you are branching from the trunk and that you do not have any mixed version. For example you can have a folder below the root be from another branch while the rest of the project is from trunk. This will cause the branch creation to fail. When having issues with branches from the navigator, try reverting the project (right click choose team>revert) several times. Then execute the cleanup several times.
Also you may consider creating the branch from the SVN Repositories view. From this view right click on the location you want to branch from (ie truck) and select New>branch from the context menu. One last step is from the navigator view you will need to swtich your project to the newly created brancn: right click on the project root and select Team>switch from the context menu