Monday, August 6, 2012

Android + Eclipse + Egit

So, after making some very small progress in my app development, it's become clear to me that I need 'version control'. 
Version control is a way for developers to keep track of code changes, to merge changes with other team coders, and to make experimental changes without fear of messing up previous good work.  A primitive way that version control could be done is as follows:

1 - Write code.
2 - Copy all files into a folder called version0.
3 - Make code changes.
4 - Copy all files into another folder called version1/.
5 - Repeat steps 3 and 4, but update the folder name as you go.

This type of homemade system has flaws.  For example, you will end up wasting a lot of space as each folder has the complete set of files.  Thankfully, this old problem has been looked into and existing version control systems already exist.  CVS, SVN, GIT are a few that I have actually used.  Among these CVS is the oldest and GIT is the most modern.

For Android development in eclipse, there is support for all of them.  After some internet research, I decided to go with GIT.  The process involves using eclipse to install the egit plugin. From there, I followed the wiki guide to create a repository to hold my code changes.  At the moment, I expect to use only the most basic superficial set of features that egit will give to me: committing changes into the repository under the main master branch, comparing my current version to old versions, and reverting to old versions from time to time.
Now that this is all set up, I can develop under the sweet protection of version control.

Update:
I ended up doing a very simple branch and merge that I wanted to note here.
Here is the workflow.

1 - Create a new branch.
2 - Code, test, save, commit the change to the new branch.
3 - Switch back to master branch.
4 - Merge the new branch into the master.

There is something nice about working in a completely separate branch, knowing that you won't mess up your previous work, that is liberating and puts your mind at ease. I guess I'm a fan of branching.

No comments:

Post a Comment