I have cloned ~60 git repositories and I would like to update the most of them with git pull through EGit. Not all, because some of them have uncommited or unstaged changes.
My first try was to select two repos in EGit (Git Repository Exploring view) but unfortunately this seems not to be possible, since the affecting button is disabled (context menu).
Does andbody know a good solution to update some repositories through Eclipse?
I am using Ubuntu 12.04 and Eclipse Juno. Sure, a shell script could solve this but I prefer Eclipse for this.
I just discovered the answer, using Kepler. This was a nightmare for me with 15 repos.
Eclipse->Windows->Preferences->General->Keys. Now scroll to Pull (make sure it's the egit one)
Set it to something like Ctl-Shift-P
Now in package explorer select the ones you want and press Ctl-Shift-P, done.
Sometimes the solution is too simple: one of my cloned repositories had no HEAD and therefore I cannot pull from it. All other repos had a HEAD revision and pulling from them works as expected.
Related
Currently using Eclipse Mars.1 and installed EGit from Eclipse MarketPlace.
Does Eclipse EGit has a similar feature of SourceTree wherein you could pick N or all commits inside a branch and compare it (git diff) to which branch is was checked-out from?
I was trying to follow low-level git branching standards relying only on Eclipse EGit tools (without terminal, SourceTree, Pull Request functionality, et.al.). But I'm only limited to seeing commit-diffs and not a branch-commit-diff view.
I think you can compare anything to anything in egit.
e.g.:
You can click on any two commits in the History view and, from context menu, choose Compare With Each Other
You can select two branches in the Git Repositories view and, from context menu, choose Synchonize with each other
You can right click on any branch in the Git Repositories view and choose Synchonize with workspace
And the list goes on ad infinitum (practically).
This is the first time I do this.
I imported a git project in eclipse.
Then I used the shell to create another branch and checkout to the new branch.
Is refreshing the imported project in Eclipse enough to tell Eclipse that we are working on the new created branch?
thanks
Right-click your project and select Team → Branch to create new branches or to switch between existing branches. You can also switch branches in the History view.
Actually, I don't think you even need to refresh the project. That is, assuming you have 'eGit' installed and your projects are already configure as git projects (they should be, because in most cases, egit does that automatically).
Whenever you run git commands on the shell (outside eclipse) egit will automatically refresh projects for you and update their status when you switch back to Eclipse.
If you are not using egit then yes, you have to refresh the projects manually, but that is all you'd have to do since running the 'git checkout my-branch' command in the shell already changed the files on disk to be those from 'my-branch'.
Actually when you are working with eclipse, eGit is a very cool tool integrated inside eclipse, which lets you do all git stuff, like
git checkout to a new branch
git create new branch
git stash
even view your unstaged changes(select files and avoid complexities caused by git add .)
and finally commit.
Read here to know more. Eclipse Egit user guide
So you get to do all version repository stuff at one place as you code.
So to answer your question, yes as you checkout a new branch even in a shell/command prompt your changes will be reflected in eclipse.
Let's say I have several projects in c:\dev\ and want to keep them there (this is my eclipse workspace)
What is the least inconvenient way to setup egit?
Turns out there is a bug in egit where you cannot create a git repo on an existing folder
You need to use msysgit to create the git repo on the command line, using git init
Then you can use egit as per the user guide
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.
I'm using EGIT to manage my GIT repository, which seems to work well so far. However, when I switch from one branch to another the files are correctly switched, however empty directories and packages that exist in one branch but not the other are left over.
I understand that GIT is based on the actual files and not the directories, however this is not ideal as my one branch was a large refactoring and therefore contains many packages that the master branch does not have.
From my research there appears to be a GIT command git clean -d that should cleanup the directories. Does EGIT support this? Or is there a way to execute this command when switching the branch with EGIT?
That looks like bug 345585: "EGit does not prune empty folders when switching branches".
It is still opened, so for now, the git clean -d is your best option (but outside of Eclipse, in a shell session).
Update June 2013, for Egit 3.0 Kepler:
A clean action has been added to the repositories view now.