Author Topic: Git and Eclipse  (Read 6524 times)

alienjon

  • Guest
Git and Eclipse
« on: March 15, 2011, 02:43:44 am »
I still don't really have free time to really play around with code right now (although I'm kinda hoping to have a look at 'Research' at some point), but I did create a GitHub account and made a fork to start learning that whole system (I've not much experience with versioning systems in general).  Anyway, I use Eclipse so I installed Egit and grabbed the source from online, but - as I haven't done much code collaboration in the past - am a little nervous with using the system.  I seem to remember a screenshot somewhere of someone else using EGit and Eclipse, might I pick your brain to make sure I set things up correctly?

Offline Daiky

  • Battlescape Programmer
  • Administrator
  • Commander
  • *****
  • Posts: 904
    • View Profile
Re: Git and Eclipse
« Reply #1 on: March 15, 2011, 10:54:23 am »
I also use Eclipse from time to time for openxcom, but only when I have a lot of editing to do. For example when I'm doing an update of all the in-code documentation. I installed the doxygen plugin for eclipse which is really neat, because it directly shows you the list of missing documentation inside the IDE.

But for the sourcecode control I use tortoiseGit. It is not hard to set up, if you follow the instructions.
And for compiling, running and debugging code I still prefer Visual Studio.

Since tortoiseGit gets the job done, and since I'm used to work with tortoiseSVN+Eclipse at my job everyday, I never felt the need for integrating both into one.

Offline michal

  • Commander
  • *****
  • Posts: 629
    • View Profile
Re: Git and Eclipse
« Reply #2 on: March 15, 2011, 11:28:52 am »
as I haven't done much code collaboration in the past - am a little nervous with using the system.

You don't have to be nervous - you can't harm anything, as you will commit and push to your private fork. So you won't break main openxcom repository.

You can even play with your own fork, and later remove it and clone official repo again.

alienjon

  • Guest
Re: Git and Eclipse
« Reply #3 on: March 15, 2011, 05:19:35 pm »
Thanks all for the reply's:

Daiky: That eclipse doxygen plugin immediately caught my attention.  I installed it before I even posted this  ;D  Thanks!  I am in Gentoo right now, though, so tortoise git isn't what I'm looking at for right now (I may try to compile in windows - I have had some luck in getting SDL to play nice with MinGW, so if needs be I could switch over for cross-platform testing later).

michal: I think that was my concern, though, was just to make sure the code would be out of my own fork, and not SupSuper's.  Since I've posted I went back and removed OpenXcom entirely from eclipse and started over, keeping a close eye on the URLs to make sure 'alienjon' was the name in each of them., so I should be working on my own fork...  I may intentionally play around with a few commits in the next week or two just to make sure it's going to the right place, so if anything odd comes up (particularly in BaseScape/Research) it's probably me and I apologize ahead of time  :P

Offline michal

  • Commander
  • *****
  • Posts: 629
    • View Profile
Re: Git and Eclipse
« Reply #4 on: March 15, 2011, 07:09:13 pm »
Since I've posted I went back and removed OpenXcom entirely from eclipse and started over, keeping a close eye on the URLs to make sure 'alienjon' was the name in each of them., so I should be working on my own fork...

It's impossible for you to push commits to SupSuper repository, as you don't have write access to it. So, even if you will clone SupSuper repository by accident, you will be able to commit changes only to your cloned repository - on your hard drive.

If you will clone your personal fork, you will be able to push your commits to github. But those changes will only be stored in your fork.
« Last Edit: March 15, 2011, 07:12:23 pm by michal »

alienjon

  • Guest
Re: Git and Eclipse
« Reply #5 on: March 15, 2011, 07:15:12 pm »
Oh I see.  So I can't commit to a clone that isn't my own.  I figured as much, but for some reason that wasn't clear to me before when I read through the documentation.  Thanks for the clarification!

Offline sir_nacnud

  • Captain
  • ***
  • Posts: 54
    • View Profile
Re: Git and Eclipse
« Reply #6 on: March 16, 2011, 02:34:53 am »
Given that you are a Gentoo user (I used Gentoo for two years, now use Kubuntu), you should have no problem using git from the command line.  I do most of my git operations from the command line, but occasionally use GUI programs to get a visual representation of the repository.

The way Git works is it is a distributed revision control system, there is no central repository where the code lives.  Each developer has a full copy of the repository.  With this repository, you can push your changes to other developers, or pull their changes in.  Hopefully this isn't confusing, but GitHub takes this idea and introduces a central repository.  So when you create or fork a repository, you create a central repository.  Then when you clone this repository, you create a local repository.  So if you do a git commit, it just goes to your local repository.  You have to do a git push, to send your changes up to your repository on GitHub.

alienjon

  • Guest
Re: Git and Eclipse
« Reply #7 on: March 16, 2011, 05:01:18 am »
Thanks sir_nacnud.  Hearing about this from various sources is definitely getting this to make more sense for me.  michal's post for the Pro Git book also looks very good (I started reading it earlier today).  You are correct that I have little problem with the command line Git, but since I use Eclipse to develop I wanted to use EGit so that everything would be incorporated (not to mention EGit's interface seems pretty cool).  My bigger issue is the conceptualization of it all, but I think I'm getting a much better grasp on things.  Thanks!