Using git for sync and backup

Nerd alert! I need to put this list of instructions for using git somewhere so it’s going here. I hope it might be useful for someone else too.
Why: One of my most valuable assets at my job is a directory full of sample code projects I’ve created over the years. Sometimes, it’s a command line tool such as “nsdictionary” which I created to test something with that API, or sometimes it’ll be a full App like “ThreadedQCLayersAndBindings” which tests complicated interrelationships. They were quick and dirty, taught me something specific, and useful as templates for future exploration and now I can’t bare to lose them.
As with any set of files, there’s two main concerns: backup and synchronization. Backup is really two parts
  1. If the hard drive fails I want to have stuff stored on another disk.
  2. If I change a project by experimenting and that experiment fails, I want to be able to revert changes quickly and easily across all files.
Synchronization just means I want to have my desktop and laptop in sync.
There are lots of tools that could work… Rsync, svn, cvs, rcs, etc. Each have their merits, but in the end take too much time to maintain or don’t provide enough features to be worth the time to set up.
Then I heard glowing reviews about Git and how it’s a distributed version control system. So I gave it a shot. Here’s a mini tutorial, if everything you’ve read (or skimmed) sounds good:
The setup: Mac Desktop and Mac Laptop and I mount the HD of one on the other over AFP. This is NOT a tutorial for setting up a git server. There may be plenty of those but that’s more than I wanted to accomplish so I didn’t even read them. Git is installed by default on Snow Leopard so this is also NOT a tutorial for setting up Git on Mac OS X. This is glorified Rsync with revisions.
1.) Create a Git repository for revisioned files
cd /Volumes/DesktopHD/Sources/tests
git init
git add -a
git commit
Yep, it’s really that easy to set up git. At this point, you can track history through the log of commit messages, and roll back as necessary.
2.) Mount the LaptopHD over afp:// by browsing in Finder, or whatever you’re used to. This also probably works for iDisk and other transport types but for now, we’ll call it LaptopHD.
3.) Clone the repository of tests to the mounted drive
cd /Volumes/LaptopHD/Sources
git clone /Volumes/DesktopHD/Sources/tests tests
cd tests
git fetch
Wow that’s pretty easy too.
4.) Add the tests I’ve already created on the Laptop to the repository
cp -r /Volumes/LaptopHD/Sources/old_tests/* /Volumes/LaptopHD/Sources/tests
git add -a
git commit
Woo I’m invincible!
5.) Then I wanted to push the new files back to the desktop (remember right now I’m at /Volumes/LaptopHD/Sources)
git push ##Don’t do this
What the… NOOOOO!!!!!! What have I done!?!?
Only use git push if you are smarter than me, which isn’t possible so just don’t. The designers put this in by mistake and it’s really horrible (I’m just being inflammatory now so somebody will come along and correct me. That’s how the internet works; I don’t question it.)
First, the correct thing to do in a setup like mine:
5.) Go back to each place that’s out of date and pull the changes back
cd /Volumes/DesktopHD/Sources/tests
git pull /Volumes/LaptopHD/Sources/tests/.git
Now the reason git push sucks:
When I did git push, I went back to DesktopHD expecting the files to be there. They weren’t so I did a git pull. Nope, files are up to date. I did a git status on the LaptopHD version, everything was checked in. Back on the DesktopHD version I did git status and all my files were in the status and marked for deletion. What??? So I killed that repository, started from scratch by copying files from the LaptopHD and did all the steps again, except with the second step 5 rather than the first.
Searching online, it looks like maybe there’s a way to set up a –bare repository and use hooks to automatically forward to your main repository or something. Crap on that. It’s easier to understand, “This is a distributed versioning system, you always pull your changes from elsewhere” and with a couple git remote add commands, pulling from multiple sources is pretty painless.
So there’s my story. I really like git now, just so long as I don’t use git push ever.

Kick Scooters

Thu and I got Xootr kick scooters last weekend. They are pretty awesome.

Despite California being so environmental, it’s a major pain to ride a bike here. Yep, California, you suck at green. On the road, bikers are lucky to get a lane for themselves. But even then, the severe lack of driving skills scares me off the road. To top it all off, bike racks are super rare. I could take my bike in with me to my appartment I guess, but at the grocery store? restaurants? my office? Not so much.
Where scooters win is their portability. You can ride on the sidewalks and then fold them up and carry them with a shoulder strap.
In high school, having a car was freedom. Now I feel the same way with a kick scooter because I can go further than walking, but I’m free from using oil. With all the anger over BP’s fuckup, it’s nice to be able to actually do something about it.

Fixing things

My beloved Mac Mini died a while ago. The hard drive went out, so it failed to boot but I had it backed up (Go Time Machine!) so I didn’t lose anything. This would be a pretty epic failure for most, but I’m a computer guy so it wasn’t a huge worry for me.

This weekend, my car’s dashboard lit up with a “Check Tire Pressure” dummy light. I was freaked. I thought sure it would be a trip to the dealer, a couple hundred dollars and/or lost time to get it fixed. (I really didn’t assume it was ACTUALLY just tire pressure, but that’s because cars are a mystery to me.)
Well today, I fixed both; and I’m quite pleased with myself.
I ordered a new laptop hard drive from Amazon, cracked open my Mini, detached the WiFi antenna, unscrewed the mother board from the housing, detached the hard drive, slid in a new one, and got everything back together and it works!
But the thing that really stressed me out, was this car light. I couldn’t see any difference in the tires so I thought it was a bad sensor. But when I took the pressure of each tire and compared it to the manual, I discovered that the front driver side wheel was 20 psi when it should be 35. So I filled it up with $.75 of air and the light went off! It’s called a dummy light for a reason.
So tonight I’m celebrating the small victories in life. Here’s to proactive backups and easy car maintenance!

Dream Merger

I’m getting married! I’ll start from the end and work backwards.

Most recently, we put up our website at, so I can finally blog and link to it. You can also just google for [Troy and Thu Wedding] because we’re awesome and have the top hit. You’ll have to do that because we don’t yet have a lot of details like time or location (who said you’re invited?) but you may read our stories and get to know us. We’ve always joked how an Apple and Google employee would be like a corporate merger, hence Dream Merger.

Secondly, the proposal was accepted in Boulder, Colorado under the beautiful Flatirons while we took a 4th of July holiday. Boulder is a special place for me, and I selfishly wanted to plant pleasant memories in Thu’s head of the most beautiful place in the world. I don’t think I needed to buy a rock for that, but it didn’t hurt.

And firstly, the ring I selected is a sapphire stone accented by small diamonds. Thu and I had been shopping so I could understand what she liked. Instead, she told me all the things she didn’t like and I took lots of notes on my iPhone so I could extrapolate what she wanted. Wanting it to be a surprise, I took the day off work and rode the Bart into San Francisco to the San Francisco Provident Loan Association where Ben and Allison made me an extremely happy customer.

Jump back with me to WWDC ’09 (2 months ago), I had just finished presenting Quartz Composer to hundreds of raving developers and knew I’d finally have some time to go ring shopping. SFPLA was the highest rated jewelry store on Yelp so I walked up to Mission street where they are located. For those of you who know San Francisco neighborhoods, Mission district can be -colorful-; so it comes at no surprise that the building looked like a cross between a 1920s bank and a jail with bars on the windows and thick plastered walls.

But the ominous exterior was no indication of the attitude within. I met Ben for the first time, and he made me feel so comfortable answering my questions about rings, giving me advice about the proposal itself. He recently got married himself, so it was like having an older brother in the jewelry business. I felt no pressure at all and he was very knowledgeable.

Contrast this with some of the places that Thu and I went after that day with shoddy quality and low customer service. The sales associates would push certain styles and “bling” on us. One place even tried to pass the softer, cheaper tanzanite off as sapphire while whispering to each other in vietnamese. Never go ring shopping at the Grand Century mall in San Jose!

So I played hooky and returned to SFPLA on the last day of June. Thu and I were leaving for Colorado the next day, so I didn’t have much hope to buy a ring in one day. I talked to Ben some more, and also met Allison who reminded me of a conspiring little sister. She was so excited by my ring selection and it really balanced Ben’s stoic humbleness so I felt both confident and excited by the duo.

The two of them were able to get it done, even going so far as to shut down the jewelry portion of the store in order to rush out to their gem suppliers to get me stones to look at, brought the different choices out of lockdown into the sunlight and within reach of that shady Mission neighborhood, then put a rush order on the setting and cleaning so it could be done before I left the city that day. It was all so perfect, and I cannot say enough about them, or the ring that Thu very much enjoys.

As I rode the Bart back home, I texted Thu, “I finished everything I needed to get done before we leave.” just to keep up the charade that I had worked all day long.


I’ve been thinking a lot about conservatism lately, so when my Dad sent me a couple of recordings of Rush Limbaugh on the subject, I decided to record my feelings in a letter to him. I’m not going to link to that hate monger Rush Limbaugh, but you can probably find the cpac videos on you tube.

On to the letter:

To me conservatism is about personal responsibility and the belief that if you work hard and everyone around you is held accountable, you can make a good life for yourself. It’s not about people, it’s about yourself.

That means that if I work really hard, I can get a promotion. If my employer produces a good product, they will be profitable. If the United States has the best morals, we can be the most admired country in the world. You can see what is not conservatism by reversing those: If my employer produces a good product, I get a promotion? If America has the best morals then my employer will produce good products? No, the work has to start from the bottom, and we can’t rely on the organizations we are a part of to give us what we want just because as a whole they are strong.

Along with the rewards of personal responsibility are the accountabilities. If I don’t do a good job at work, I’ll be demoted or unemployed. If my employer doesn’t produce the products that people want, then they need to cut costs and figure out who is not doing their job right. And if the United States doesn’t have the strong morals, then it will need to figure out why and fix it.

But there’s something troubling about that belief lately, and it’s causing me to doubt. External and uncontrollable factors are creeping in. People who made bad decisions about buying a home are causing turbulence in the financial markets, and it could cause my employer to loose sales, and it could cause profits to be down, and cause arbitrary layoffs of good employees like me.

People lied to us about the Iraq war committed crimes, and they are getting away with it. I don’t know whether the former president should have immunity in such matters, but if he tells someone to do something illegal then one or both of them needs to be held accountable. If not, future generations will blindly follow commands because they have no personal responsibility.

Climate change is happening on a broad scale, energy prices are bound to continue upwards, terrorism will still exist in the world and many other systematic problems will plague our world and “conservatism” as I see it cannot solve any of those problems. Really, these systematic failures prove to me that conservatism is false, and that’s rather unfortunate.

We have to work together to get out of the financial mess and keep the greedy few accountable on Wall Street. (That includes an end to pussyfooting around with 90% taxes on bonuses and just fire those who lead companies that take bailout money.) We have to work together to make sure that the people who permitted torture in Guantanamo are locked away for a very long time. We need to work together to slow climate change, repair relations with the “others” and drop our dependence on foreign energy.

I hope that big government is NOT the way to do this, but I know that “conservatism” as defined in the dictionary as “preserving the status quo” will not get us there. Nor will listening to a drug addled hate monger like Rush Limbaugh. At the beginning of the 3rd recording he says “Stop assuming that the way to beat them is with better policy ideas.” Well Mr. Limbaugh, if you have no ideas stop wasting so much air. The only way to get past all this is with creative thinking, something that we Americans are good at.

We need to be progressive, we need to work together, and we need to understand that there’s no easy way out of the mistakes we’ve already made.

* On the videos themselves, can anyone show me proof that Joe Biden said Bobby Jindal missed a day of work at 7-11 to give his response to Obama’s state of the union as Rush joked? It’s true that he said that “You cannot go to a 7/11 or a Dunkin’ Donuts unless you have a slight Indian accent” which is bad but also years ago so we’ve all been over that plenty by now.

But pretending that a successful Indian like Jindal or many who work in the silicon valley cannot get further than 7-11 is way worse (7-11 may be the American dream to some, so Biden’s comment may be referring simply to the American dream.) The comment about Jindal appears, to my limited search, to be a Limbaugh original. Can anyone point me to video or respectable-news quote attributing Biden? All I can find following that speech is “conservative” ann coulter calling Jindal the “Slumdog candidate” so Rush not only proves himself a racist, but other Republicans follow his leadership.