Fscking up with git and how to solve it

Posted in Uncategorized by elisehuard on March 24, 2010

I’ve been using git for nearly two years now, but this job is the first time I’m using it with more than 2 people on the same project. And it’s different, I can tell you.

In this case you need a workflow: we adopted this one, also described here.
It’s a good workflow. But human error means that you can go wrong.

Forgetting to branch

The workflow demands that you do all your work on branches – that way you avoid merges on master, and can maintain a nice straight and clear master branch.
But, as you start working on a new feature, you might forget to do that

git checkout -b boldly_go

And start coding and committing on your local master.
What now ? Well, git offers an easy solution. Tag your latest commit (give it a label)

git tag boldly_go_tag

reset the master to its remote position (do not use –hard or you will lose your work)

git reset --soft HEAD

create a branch out of your tagged commit, which is not on any branch just now
git checkout -b boldly_go boldly_go_tag

git checkout -b boldly_go

to create the branch

git checkout master
git reset --hard origin/master

to reset the master to its original position.

My last commit message lacks poetry

Or I forgot to add this one file. Solution:
git commit -a --amend

Forget I ever did that last commit

Careful, this will remove any changes you added in that commit. This will only work locally, of course:
git reset --hard HEAD^

Going off the map

As you work on your branch, you want to do regular rebase with the remote master, to minimize any later merges and avoid surprises. After every commit:
git checkout master
git pull
git checkout boldly_go
git rebase master

Here’s where you can go very, very wrong: as long as you’re in rebase state, you’re in a situation where you’re NOT on a branch. So if after a coffee break you forgot you’re in rebase, and you continue working, you’re working into the void !!
$> git branch
*(no branch)

If you then try to do a rebase again to get up to date with master, you won’t find your commits where you expected them. Oh noes ! Where did my work go !
No panic (to be honest, i did panic a little): git keeps all your commits. You can find them in the .git/objects directory, if you care to have a look. What you just did is create a ‘dangling commit’, that is a commit unlinked to any branch. Fortunately, there’s the aptly named git fsck command.
git fsck | grep commit
(the grep commit helps separating the commits from the other dangling stuff) then use the SHA associated with your commit to create a tag:
git tag sos 9a4e6286aa2e2bd97334ad35b555169c2d3033b4
git checkout -b not_so_bold_now sos

this creates a branch based on the tag, and you can continue working.

another good one to know in that case is
git reflog
this shows all commits, dangling ones included, with their message, making it easier to find the commit you’re looking for. Same procedure for the rest.

This and many other tips, and sources, can be found on git-ready.
Thanks to Alain Ravet for some of the tips 🙂

The Real-Time web

Posted in Uncategorized by elisehuard on October 16, 2009

Like all of the over-connected, I’ve been intrigued by the hype around the so-called realtime web, so i’ve been looking around and reading up. Today, I had an opportunity to bring it all together in a short presentation.

The main points I was trying to make:

  1. nothing new under the sun, technologically: HTTP callbacks, and then ajax and js push for the webby stuff
  2. taking a step back, and having a nuanced view, is as always a good idea

The structure is partly inspired by Jeff Lindsay’s talk about webhooks at Pivotal Labs. I gave 2 demo’s. The first is the one described by Ilya Grigorik in his post about pubsubhubbub, where I used the watercoolr site itself and postbin. The second was an illustration about how the magic of Google Wave can be reproduced using ajax and juggernaut (though I’m sure their solution has more complexity, since they have a much, much higher load).

The last image (the house) is to talk about a nice example of the real-time web (internet of things, yay): the Pachube application now has triggers. Pachube acts as a hub for sensor information: so that means you can put triggers on your sensor data. As in ‘my house is colder than 10 degrees, notify me’.

Service announcement: I’m going to move this blog to another hosting very soon, under a new domain name (jabberwocky.eu). Well, I’ll post here to say it, anyway.

Webapps and user accounts

Posted in Uncategorized by elisehuard on January 19, 2009
  • If at all possible, don’t use user accounts. No login-password. We already keep too many of them, on so many sites.
  • If user accounts are really necessary, and security is not paramount, try to go with OpenID. See previous point.
  • If OpenID won’t cut it, use an email address as login. Chances are you’ll need one from your user anyway, so that removes the redundancy in login info.
  • Only if you want a nickname off your user, let them specify a username-password combination. Make it easy to retrieve lost passwords, because they will lose them.
  • use SSL with decent algorithm for any connection that sends passwords over the wire, otherwise you might as well drop the user accounts.



Posted in Uncategorized by elisehuard on January 9, 2009

As geek, you’ve got a unique perspective on innovation: you can approach it from two different directions.

  • get familiarity with a technology => imagine new uses for it
  • have an idea => figure out how to do it with existing technology

I wonder if our technical knowledge is actually a constraint, where creativity is concerned. Is thinking out of the box more difficult when you’re very aware of the box ?

FOSDEM Ruby devroom: call for papers

Posted in Uncategorized by elisehuard on December 11, 2008

As you all know (or really should know), FOSDEM conference takes place on the 7th and 8th of february next year. Again, this year, BRUG is manning a Ruby – RoR devroom on saturday.

If you stumbled upon or wrote a particularly nifty bit of Ruby code, or you’re an expert on a particular aspect of Rails, you should apply for a talk !

The wiki; says:

We accept 25 minute and 50 minute talks and tutorials, but we are not strict on this so please indicate the preferred length of your talk/tutorial in your proposal. We may still slightly adjust this length depending on the response we receive. We would like to ask you to include a short bio when you submit your proposal. This bio will appear on the FOSDEM website and should consist of a single sentence description and an extended description; examples can be found in last year’s program: http://archive.fosdem.org/2008/schedule/events .

Unfortunately, I can’t do anything myself (should i think of a subject), since i’m part of the organizing team, and other team members have already suggested that we will all be incredibly busy.

Cloud Camp Brussels

Posted in Uncategorized by elisehuard on October 31, 2008

cloudLast night I attended the first Cloud Camp Brussels. Who in IT hasn’t heard about The Cloud ? Like any successful buzz-word, it’s short, it’s sweet, it sells. Like my peers, I’d tried out the Amazon offering (S3, EC2, …). I’d been meaning to have a closer look for a while, and last night was an opportunity.

The evening took place on a boat on the canal in Brussels (nice). It started with a keynote by Tarry Singh – who is obviously very smart, but has trouble translating this into a structured speech. Or maybe he just wanted to cram too much into his limited time-slot. Something about economics and the cloud taking off, anyway.

After this there was a panel discussion by five people from different sponsoring companies. Q-layer, Microsoft (surprise guest after this week’s announcement of Azure), Salesforce, Cohesive FT, and ITricity.

This was interesting, because what emerged was a better definition of the “Cloud” concept. There seem to be several definitions – which is not that surprising, considering the metaphorical nature of the name.

  1. cloud computing is the offering of excess IT capacity (processing, disk space …) to external buyers, a bit like an electricity provider could sell overcapacity to neighbouring suppliers on demand. As such, it’s a business model, not a technology (“web hosting”)
  2. the geeky cloud: the group of not-so-new technology, virtualization, DNS, tools, networking allowing this kind of trade
  3. the cloud is software as a service. This is the definition Microsoft, Salesforce, and Amazon adhere to, since they offer services (though Amazon is an edge case)

In fact, this mix of definitions explained the variety of people present yesterday. Marketing people (suits) from companies selling tools for making a cloud for data center owners, companies selling cloud type 1, and companies selling cloud of type 3. Then, for 2, there were virtualization geeks and curious geeks like myself.

Subdomains and rails

Posted in Uncategorized by elisehuard on October 8, 2008

We’re working on a system using subdomains as an account key.  This common, but still cool feature allows people to have their own virtual webspace, adding their own subdomain, say

elise.ilikethissite.org, or coolboots.myclub.net

This is relatively easy to do in Rails itself – the plugin subdomain-fu (railscast here) makes it almost childs play.
So the problem is not rails, but setting up your development environment to be able to work with it.

  • web server : your web server has to accept wildcard aliases for all subdomains. On most modern servers this is relatively easy, i know Apache (ServerAlias), lighttpd (regular expression for the $HTTP[‘host’]) allow this no problem, and this should be the case for other modern web servers.
  • DNS : if you don’t fix this, DNS servers outside your machine will try to make sense of the address, which is of course not what you want. On a mac OS X Leopard in its original state it’s not possible to use wildcards in the /etc/hosts (at least it will not listen). The life saver here was the following link : setting up your own DNS server locally on your machine.
  • (Update) A last gotcha: sessions.  If you want your users to be logged in and logged out throughout your site (regardless of subdomains), you could use a small amendement as in this link.  However, that may not be what you need – sometimes you want to keep the worlds separated, so that’s up to you.

And you can have your own cool fake domain names to play with in development !
Walking on the shoulders of giants, don’t you love it …