Moving from Subversion to Git

I just finished moving my files from Subversion to Git. Git is a distributed version control first built by Linus Torvalds and has matured a lot since its first creation. It is currently used by a number of important open source projects including the Linux kernel, Perl, Wine and Ruby on Rails. I chose to move to Git for a number of reasons:

  1. Distributed: So I can make commits even if I’m not online and have a complete history of changes.
  2. Easy branching and merging: I found myself keeping a ‘scratch’ folder in Subversion and only transfer changes to a working copy once I had finished all my changes. I feel that this defeats the purpose of having version control. Git supports easy branching so I can make experimental branches (which have their own histories) and then merge them back into the main branch when I’m ready.
  3. Normal commands like mv, cp, rm can be used as Git doesn’t track files individually.
  4. Interacts with SVN: I’ll need to use Subversion for my school projects, but I can have a personal Git repository where I make regular commits and only push to the team’s Subversion repo when nothing is broken.
  5. All the cool kids are using it.

I have two subversion repos: one for my code and one for other documents. The move from Subversion to Git was actually quite smooth. My repositories currently live on my old G4 Powermac, so I decided to do the transition on that machine itself (though I didn’t need to due to Git’s distributed nature). I had found a quick tutorial which I followed to do the actual move from a Subversion repo to a Git repo. I then did a quick git clone as follows on my laptop and desktop:

git clone ssh://domain.com/path/to/repo/

I could have used the simple Git server instead of SSH, but since I would be doing regular pulls and pushes (updates and upstream commits), I decided to just use SSH uniformly. Since then I’ve made changes to my Source repo and it has synced properly to my desktop. I ran into a problem where one of the git commands could not be executed on the remote machine. This turned out to be a problem with SSH on OS X, where the path for the non-interactive shell started by Git didn’t have the proper path. I didn’t research it very much because it turned out that the adding the following line to my ~/.bashrc solved the problem.

PATH = $PATH:/usr/local/git/bin

This adds the git path to the users path and lets the clone run properly.

The only disadvantage is that I have do a commit to my local repo and then push it to the repo on my server. However it’s still a simple process. Whenever I make a change I want to save I do a simple

git commit -a

and enter an appropriate message. Then before I leave my computer for a long time I do a

git push origin

which synchronizes all my local branches with those on the server. A simple git pull suffices to update the local repo.

I haven’t had a chance to use this system fully yet as I haven’t done much moving about. But classes start tomorrow so I hope to have a chance to use my new system properly. In particular I plan to make use of the easy branching and the SVN integration. My college’s lab machines don’t currently have Git installed on them, but I’m going to request to have Git installed. From what I’ve seen of the faculty, this shouldn’t be hard to accomplish. Here’s looking forward to the rest of the year using Git to boost my programming productivity.

More ways to stop wasting time at your computer

Almost two years I published a post about ways to stop wasting time at your computer. Since then the post has regularly made to the top 5 most viewed posts on the site. Though I love computers and regularly spend many hours the day in front of one (mostly typing something or the other), I also appreciate the value of getting your work done quickly and having time for non-computation related activities. So I’ve decided to go back to my old list and remake it with some lessons learned in the two years and many hours spent computing since then.

1. Combine and conquer.

You probably spend a significant part of your day interacting with other people over email or IM and reading blogs and other websites. You can save a good amount of time if you pull related activities into a single point. For example, use an email client of Gmail to consolidate all your email accounts so that you don’t have to spend time logging in and switching between all your accounts. This also reduces the mental overhead required to deal with which email was where. If you have a number of websites or blogs that you visit on a regular visit, then look if they have RSS feeds (blogs almost certainly do). Add them to a feed reader (I recommend Google Reader). Once again you’ll save a lot of time by having things in one place. For IM, there are a number of good applications that allow you to sign on to multiple networks at the same time. Try Adium for the Mac, Pidgin for windows and Linux and Meebo if you switch computers a lot.

2. Know your tools.

Chances are that you spend most of your time on just a handful of programs. For average users it’s probably a browser and some office programs. For programmers it’s probably a browser and an IDE of some sort. Specialized users like scientists or accountants generally have their own programs. No matter what you do, consider investing time to get to know your tools properly. Most programs have keyboard shortcuts which aren’t hard to learn. Keep a cheatsheet in front of you and in a few weeks you should be able to do things a lot faster. Also remember that moving your hand from the keyboard to the mouse and back takes time which you can save by using shortcuts as much as possible. If you find yourself a serious of tasks over and over see if your program already has a simpler way of doing it or something like a macro or scripting that can automate it. Most people only use a small fraction of their programs features, but if it is something you use for hours a day, it is worth your time to learn it a little better.

3. Multitasking.

The ultimate dilemma for computer users. The computer lets us to do so many things together, it’s tempting to do them all at once. Since publishing my old post (in which I advised against multitasking) I’v received a number of queries regarding multitasking, in particular what to do if you’re in a situation where it can’t be avoided. All things considered, my opinion stays mostly the same: Avoid multitasking unless it’s really necessary. The scientific reason is that human short term memory is severely limited: we can only hold about 7 individual chunks of information at a time. Though with training you can redefine these chunks to be complex sets of information, it’s  still a pretty hard limit. Furthermore, if you spend a large amount of time focused on one task you enter a state of flow, where you become fully immersed in what you are doing and work better and faster.  But this flow state is fragile and once broken can be hard to reenter.

So what’s to be done when it is necessary? Well if you’re switching between multiple programs, try to have them open at the same time instead of needing to start them up everytime. All those programs will require some extra horsepower so consider getting some more RAM and maybe a larger monitor so that you can see all those programs at the same time. If that isn’t an option, try using lightweight programs that take up fewer resources. If you’re on Linux or BSD, try a tiling window manager that lets you easily see programs side by side with minimal manual management.

If you have sufficient control of your work schedule, then nothing beats good old fashioned time management. The single most effective tip I’ve find is to divide your time into segments so that you have long blocks of time where you can concentrate on big programs (writing a program or that novel you want to publish) and separate blocks to handle a bunch of smaller tasks which require shifting attention (like email, answering questions, making phone calls, cleaning up or making plans for the rest of the time).

4. Type faster.
Let’s face it, no matter what you do, you’ll spend a significant amount of your time typing. I’ve mentioned in numerous posts before that typing fast is a very important skill. There are lots of typing tests out there to test your speed and lots of ways you can improve. If you work in a position where typing is a large part of your job (programmer, writer, secretary, medical transcription) then a proper typing course will almost certainly be a worthwhile investment. While you’re learning to type at light speed, you want to make sure you’re taking care of yourself with the proper equipment. Trying to set up an ergonomic work environment and at the least get a keyboard that you’re comfortable. Remember that keyboard preferences varies greatly and you won’t find one you like until you try out a few. My professor uses Microsoft’s split ergo keyboard while I personally type fastest on my laptop (I love the scissor keys) and can’t stand the older Mac keyboards.

5. Disconnect when possible.

The internet can easily be a great distraction and time waster. Twitter, Facebook, blogs, email all can swallow up massive amounts of time without you even noticing it. I strongly recommend disconnecting (by which I mean physically yanking out the cable or turning off the wireless) whenever you can. How realistic this is depends a lot on what you actually do. A programmer will almost certainly need to look up documentation regularly (but this could be downloaded and stored locally) while a novelist probably does not need a connection to write the chapter where the main character turns evil and the plot thickens. Even if you do need the internet to look up information, at least turn off IM and close your email when you’re working hard on something else. People can often be the greatest distractions of all. Try to organize your work in advance so that all network related work gets in done in a certain block of time, leaving the rest to focus on other important things.

6. Go minimal.

The best way to not give into temptation is to avoid it altogether. Close applications that you won’t be using for a while. If you have separate work and play machines, make sure that there are no games or other distractions on your work machines. On a single machine, consider setting up separate user accounts. Considering using a plain text editor instead of Word so that you can’t start playing with formatting. If you find yourself constantly customizing your setup, make it a point to stop doing so. Once again using something like a tiling window manager will stop you from wanting to keep adding useless frills.

7. Try to work away from the computer

Even though computers make lots of things much simpler, ask yourself if all your tasks need a computer. Do you really need Google Calendar or iCal to keep track of your schedule when a simple paper organizer will do? Do you plan on organizing class notes on your computer, but find yourself IM-ing when you should be studying? Why spend time writing an email to the guy down the hall and waiting for a reply if a half minute conversation will do? The best way to stop wasting time in front of your machine is to not be there is the first place.

I hope that these tips will help you find ways to get things done faster and better. However, even if you don’t apply everything that I said, there is one thing that you should remember: if you really want to not waste time, then you need to make a plan for what to do with all the free time. Otherwise any time you might save will probably get wasted anyway. Inertia is a powerful force. Once you’re sitting in front of your computer, it’s tempting to stay unless you have a reason to move. So before you start applying these suggestions, make sure you’ve found your reason.

Satyam and the Indian software industry

I don’t usually write about industry because there are lots of blogs out there which do exactly that. However once in a while, things happen which warrant an exception. Today is one of those days. Even though most of the world is reeling under the blows of the credit crunch, my home country of India is relatively unaffected. But one financial situation that is currently worrying involves one of the Indian IT industries giants: a company called Satyam Computer Services Ltd. The company provides various IT services around the world and serves over 650 companies, 185 of which are Fortune 500. A few days ago the company’s founder and chairman admitted to falsifying financial records to the tune of millions of US dollars. The company is in severe trouble and a new board has been appointed by the Government to help it. More importantly, the company is in serious danger of going under causing thousands of people to lose their jobs and there is talk of a government bailout.

Being an IT company, a large fraction of the company’s thousands of workers are programmers. Yesterday a national newspaper reported that credit card companies and banks are freezing the accounts of lots of employees because it seems unlikely that Satyam will be able to continue paying monthly salaries and so the employees won’t be able to paying their credit card bills. While the average Indian isn’t as dependent on credit as people in western countries, this sudden loss of financial backing for the common employee is troublesome to say the least. And even if Satyam can somehow be salvaged, it seems inevitable that at least some programmers will lose their jobs.

The unfortunate truth is that being an employee you have almost no way of knowing what is going on at the higher levels of the company. While it might seem like your employer is treating you well and is doing great, the truth may be quite different. After all no one could have predicted Satyam’s current crisis until it errupted into full public view. Especially if you’re a programmer, it’s unlikely that you know (or even care very much) about your employer’s accounts.

I’ve always had mixed feelings regarding the Indian IT industry. The largest computer technology companies are geared towards providing services for other businesses. Unlike the large US technology companies like Microsoft, Apple or Sun, the Indian companies aren’t really involved in actually producing new consumer technologies. Outsourcing is, to a large extent, the lifeblood of the Indian IT industry. The constricted focus of the companies also means that their employees have a more restricted set of work opportunities. I don’t think you’ll be finding any compiler writers at Satyam. While outsourcing has greatly boosted the Indian economy in recent decades, I think the high salaries paid by these companies have lured away a large number of intelligent minds who are currently working on problems that are far below their potential. There is also an dangerous shortage of talented minds working towards advanced degrees in computer science and engineering, which I feel will shortly lead to a serious shortage of educators.

This is an important time for the Indian IT industry. The fourth largest IT company in the country is struggling and another large company called Wipro is in trouble with the World Bank. It is almost certain that this will have some effect on the readiness with which companies will outsource their IT needs in the near future. I hope that this situation will make people realize that there is much more to computer technology than IT. I would like nothing better than to see companies start producing technology that can be widely used: frameworks, developer tools, maybe even new platforms. On a large scale I’d like to see Indian competitors to Microsoft and Sun emerging. Even if that doesn’t happen (and I’m not very confident it will) I hope that programmers around the nation will realize that their jobs are not the best they can have. I would love to see some of these programmers start their own companies, perhaps to fulfill local IT needs rather than attract outsourcing. These are troubled times indeed, but it’s times like these that breed innovation.

Change of scenery

I’m back from a refreshing vacation in South East India. I didn’t miss the internet and computers as much as I thought I would. The break gave me some time to think about things I want to do in the year to come and I also discovered that I’m interested enough in photography to take it up as a serious hobby. I have some ideas for what I hope will be interesting posts in the days to come. While I’m actually writing there posts, I’m doing a gradual redesign as well. I really wanted to go with a darker theme, but I couldn’t find one on WordPress.com that I really liked (another reason to switch to independent hosting in the future). So I decided to use the Garland theme (which I’ve used before), but with a dark color scheme. I have mixed feelings about this theme. I would have prefered more control over the colors, but I don’t want to pay for custom CSS at the moment.

I used to have the top posts widget in the side, but I’ve decided not to keep it. The posts which get the most search engines aren’t really ones that are representative of what I would like this blog to be. I’m still trying to figure out what would be a good way to present new readers with a list of good posts, but for the time being I’ll stick to just having the recent posts show up. I’ll be using the left sidebar as a more direct channel to the outside world, with my Twitter and del.icio.us feeds being displayed. I’m also working on rewriting the About page and adding a page with links to longer articles. All this is part of my effort to make this more of a well-rounded website representing who I am and what I do, rather than just another blog. As always, comments on the redesign are very welcome.

A week without Internet

I’m leaving tonight for a family vacation for about a week and as far as I can tell I’ll be without an internet connection for that time. I don’t think I’ve ever been without internet for so long since I got online in 2001. I shouldn’t be bored with all the sightseeing that’s planned, but just in case, I’ve packed a bunch of books which should help me pass the time. I won’t be having my laptop with me either, which means no programming either. I was looking forward to learning Lisp properly before college started again, but considering this is my first real vacation in a long time, I’ll gladly accept the delay. And I’ll still have two weeks to catch up. So check back in a week for something more interesting.