Thursday, October 4, 2012

Git, Eclipse, Can't we all just get along?

I've been using vim and cvs for all of my programming life. I'm still using them.  But I thought it was time to step into the 21st century. So here I am, building android apps with the modern Eclipse IDE and the trendy git versioning system. 

Thus far, I have been impressed.  Git is powerful and Eclipse is one smart tool; autocomplete alone feels like magic.  But, it hasn't all been easy. 

Here are the two scares I had:

1. In eclipse, I created a branch.  I made my edits, and then I asked eclipse to merge the branch back into the master. I've done this before, but this time Eclipse had issues.  I don't remember the error message, but there were errors everywhere.  So, I asked Eclipse to switch back to the branch I was working on. Oops. Eclipse said No to that too.  Ok.  I'll restart Eclipse.  Crap.  Eclipse opens and the project is empty.  I ask to switch branches, nothing. Eclipse says that there were merge errors and I'm not allowed to switch branches.

I went back to the terminal. I opened the folder where my git repository is, and there was nothing there. After a moment of stupid panic, I ran 'ls -a' to see the hidden files.  Aha, there was '.git'. So I ran 'git branch', saw my branches, and checked out my last good branch.  I merged files using the command line and all was well again.

I'm not sure what I did. I don't know why eclipse decided that the best way to do a merge was to hide all my files. It was probably something that I did.  Oh well. Ok, I'll just merge from the command line and not within Eclipse anymore.

2.  All has been going well. I code and debug in Eclipse.  I create and merge branches in the terminal.  But one day, I open the project, and I have lots of errors. 100s of errors.  After going crazy for a bit, trying to build, clean, changing build paths and so forth ... I was ready to give up. Screw these shiny magical tools.  I never know what the heck is going on.  Well, I realized after a bit that Eclipse had wrecked my imports.  I deleted the ones that were there and re-added the ones I needed manually.  Who knew that Eclipse or Git would decide to change my imports?  I have no idea what happened.  Oh well.

I guess, what doesn't kill you ... gives you something to blog about.

No comments:

Post a Comment