Egit: Right click not showing GIT commands - eclipse

I can't see the GIT commands when using right click on any files in a GIT repository.
I'm using Eclipse-Luna, A fresh install, afeter trying different versions of EGIT.
Thanks,
Elyahu
Some screen shots of the preferences:

I can't see the GIT commands when using right click on any files in a GIT repository.
You must first share that local project in order to make it recognized as a Git repository.
See "How make Eclipse/EGit recognize existing repository information after update?",but don't forget, once shared, to close/reopen your project.
Then Git will be active on said project.

Related

Git working copy into Eclipse

I can't figure out why I can't get a working copy from a git repository into Eclipse PHP Explorer.
I think to have followed the steps I have been reading:
http://wiki.eclipse.org/EGit/User_Guide#Cloning_Remote_Repositories
http://www.vogella.com/tutorials/EclipseGit/article.html
But at the end of the procedure I don't have the code at the PHP Explorer. But the way, at Git perspective I can see the git repository.
The only options I can see at Team context-menu, are:
Apply Patch
Share code
By "share Code" option, the project files are moved into the git repository folder. By doing this:
the project tree parent has detected the git repository, I can see at the root tree [gitpoject git]
at the project properties, on Git section, I can see the Git repository data correctly
The Team contextual-menu has now the expected Git commands
If I do a commit from the root-tree, the Commit windows is shown and wants to add the Eclipse project structure.
But I can't see the code holded into the git repository into the project.
I tried to clone the git repository with "Git Bash" by one side, and import this folder into an existing project without luck.
Anyone could help? Thanks in advance.
Even if this not responds completely the problem I have explained, the only way I can have a working copy into the Eclipse PHP Explorer is by:
Make a git clone through Git Bash
Create a new project (PHP Project) and select "Create project at exisiting location" for Contents
By selecting the directory I have the repository cloned, I can see the contents of this repo now at the PHP Explorer and use the Git tools.
If someone could clarify why the procedure I have followed has not worked I will appreciate to understand it.

Use CVS and GIT together in Eclipse

I already have a CVS and that cvs is used to share the source among other developers. But I need to keep a track of my source code changes separately. Moving the project from cvs to git is not practicable here.. and you may think that why 2 versioning controls. Any way I need to have a separate repository. I have tried git with eclipse. It is ok. I want to know how I can use both my personal git repository and cvs together in eclipse. (For example, when I commit my changes in eclipse, Team -> commit .. How can I separately commit to both cvs and git..and whenever I need to see the history in eclipse, separately git and cvs.. .Also when CVS server is not supporting, I can work with my local git repo as well. ) I need to handle all in eclipse IDE. Any one give any tutorial or links for my solution, it is highly appreciated.
You can have a git repo directly within your sources, but Eclipse would still be set on using CVS (and cannot show you both git and cvs commands at the same time).
That means you go on committing with CVS and Eclipse, but would need to commit (locally) in Git with an external tool (either a simple command-line session, or any GUI you want, like GitHub for Windows or SourceTree)
It actually is possible, if you create a dummy Eclipse project and designate the git repository at the workspace root (.git directory at same level as all projects in the workspace). This way when you make commits from this project, all projects in the workspace are its members and you can keep the members themselves connected to cvs.
You can create such repository by first creating the dummy project, and (Team->Share) sharing it via git using the Configure Git Repository dialog. Select “Use or create repository in parent folder” and explicitly remove the project folder from the "Create Repository" line after checking (checkbox) the project from the list of available projects.
After pressing "Create Repository" the project directory suffix will reappear, but remove it again before pressing Finish. In my version of Eclipse pressing Finish will hang, and I must terminate Eclipse to restart it.
After restarting the dummy project can be used to Commit files in all the other projects while the other projects remain connected to cvs.
Screenshot of “Use or create repository in parent folder” view when pathname has been entered by pressing "Create Repository" and then (corrected again before pressing) Finish.

How do I configure Eclipse to use an existing git repository with existing source code?

I have Eclipse Juno with EGit and a project that I've been working on for a while. I've decided to move it to Git, so I created a Github account and downloaded and installed the program. The repository is at C:\Users\username\GitHub\project_name\, but all it has is the README.md file.
How can I configure Eclipse to use my existing source code (in a workspace separate from the git folder) to work well with git? I've tried using Window → Show View → Other and selecting "Git Repositories," but other than adding a repository (which I have done) I can't figure out how to sync the code.
I've read this question but I get the impression that those answers will perform a one-time commit, instead of a sync.
To clarify: The repository does not have any code. I would like my existing code (in the Eclipse workspace) to be synced to the new repository.
If you already have a git repository in place, first copy all your files to that directory (yes, manually) and do a git commit -a to commit all the files into the repository. I'm assuming here that you've already initialized the repository at C:\Users\username\GitHub\project_name\ with git init.
In eclipse, go to File → Switch Workspace → Other... and point it to a workspace of your choice that can be completely different than the location of your code, or your earlier workspace. In fact, don't point it to the directory which contains your git repository.
Once you have a clean workspace, go to File → New → Other..., select Git → Git Repository and enter the path of your git repository (C:\Users\username\GitHub\project_name\). Enter a name for the repository, and click Finish.
I would really recommend you read at least the first few chapters of the git book to understand how git works, and to help you push and pull code to and from remote repositories.
If your existing repository is not git, you're going to have a hard time keeping the directories in sync. You might want to setup rsync to sync the directories. There is no way AFAIK for eclipse to automagically keep the two repositories in sync.

How to check out a project from a server with Git

You may classify my question to the layman's level, but I am using Git for the first time (til now I used TortoiseSVN) and I am not sure how I can check out an existing project from a server, so as to have it available on my local machine in a folder. I have installed Git Bash. Should I run it (Gui), select New Archiv and then specify the path of the project in the server? Is there a better Git framework to install, which is appropriate to make the same task more easily?
I would appreciate also some screenshots if needed in the answers.
Update: I have installed also TortoiseGit. I want to create a new clone by a right click in a directory, but the new Clone is not available after the right click. Does it need additional configuration? If no, what should I do from TortoiseGit to checkout an existing project?
I'd usually recommend learning git from command line. But if you are already familiar with TortoiseSVN then TortoiseGIT is a good tool for you.
Also, I think you should learn git very well. I can recommend the book Pro Git.
To "check out" a git repository is called clone in the git world (you will get a whole copy of the server repository). This can be done either from command line or TortoiseGIT.
git bash:
$ cd /path/to/my/projects
$ git clone url-to-server-repo
Update:
Since you get the "normal" TortoiseGit menu (without clone option), it seems you already have a local git repository. You probably created an empty git repository by mistake. Look for a hidden directory .git in the project directory or any parent directory.
right click on the folder (not right click on nothing in the folder, the icon of the folder you want to clone INTO from the parent directory) and select clone from the menu.
FYI:
clone = create a copy of a repository.
checkout = change the current state of an existing repo to a saved state.
so if you have a repo w/ 3 commits (A,B,C) when you clone the repo you will be at the most current state (C). if you want to see the previous state of the repo you would git checkout B. if you want to see the repo's initial state you would git checkout A
hope that helps.

Git, SVN and Eclipse workflow

I am trying to adopt the following workflow:
git svn clone a svn repository through command line (egit doesn't support git-svn)
Open the project in eclipse with egit since I rather use egit to branch, merge, commit etc...
When i'm ready commit the changes back, I use use git svn dcommit to commit back to svn
I am having trouble with step number 2, don't understand how to import a git project, eclipse tells me i can't import it to use the same directory it's currently in because another project with the same name is already there. this is confusing.
Anyone knows how to do this ?
Also would like to hear other workflow examples that uses egit and git svn. I am aware that it is better to do it all through command line, however, I am trying to ease the move to git for fellow developers in my team, who are not used to command line interface etc...
I've worked briefly with the egit plugin (I actually recently stopped using it and just use msysgit as my Git guiclient and run it separately from Eclipse). I find Eclipse very busy as is and adding this plugin slows it down (for me at least).
What I did when setting up an already cloned project in Eclipse:
In Eclipse. File -> Import -> Existing Project into Workspace
Select root directory of project. Do NOT check copy projects into workspace. Click finish.
After project has been imported. Right click on project, go to Team -> Share Project
Select Git as a repo type, click next
Check use or create repo in parent folder of project. Since you already cloned the project it will be tracked with git. When you check this option it will show the project, the path, and the repo (.git).
Click finish and you will be all set.
I think you'd better use SubGit instead of git-svn.
SubGit works on a server side. It synchronizes all the modification between Subversion and Git repositories automatically on every incoming modification from either side.
From the client perspective SubGit enabled repository is a usual Git repository, so you may pull from and push to it. Please refer to SubGit documentation or SubGit vs. git-svn comparison for more details.