Gecko’s Guide to GIT

I’ve convinced my work colleagues over at Gecko-Research to start using Git.  I’m a git neophyte myself, but now I’m in the position of setting up our Git repository, and teaching my colleagues how to use it. I’ve written up a little guide to using Git, aimed as a reference for myself and my colleagues.   As such, it’s just a list of the commands that we use on a regular basis, or the situations we are often confronted with (and how to deal with them).  The post is totally a work in progress, so it will likely change quite a bit over the next few months as I flesh it out as needs arise.

If you are interested in a general introduction to git, or a tutorial, I would suggest one of the following:

Git has a reputation for being difficult to use, or counter intuitive, but I think that’s just due to it being a distributed rather than central revisioning system (based on the concept of a central repository).  Some things do get tricky, but I think it’s primarily because git lets you work in new ways that can potentially trip you up.

Central repository systems are easy to conceptualize,  and they’re what people of our generation are used to, so they are easy to get started with.  Git  is based on a distributed model, in which each repository is equal (we can assign different roles to different repositories, but it’s not technologically imposed).    Considering that distributed systems are so becoming the norm (bittorrent, wikipedia, the free software movement, multi core computing, creative commons, blogging, twitter…) ,  I suspect tech heads growing up now will find thinking in a distributed way as simple as we old farts find the top-down, central-repository, client-server model.

Daily Use

Note that these comments are aimed at my colleagues. Your work situation may vary.


You should commit your work whenever you get anything done that can easily be summed up in one line (the commit message). There are other reasons to commit, so when in doubt, do a commit. It’s easy to go back if you need to. Committing doesn’t go on the net, it just tells your local git repository that you got some work done, and puts those changes onto the local index (git’s database of what’s what). Frequent commits will save you hassles. The command is:

 git commit -a

The -a tells git to commit all modified files (which are being tracked). You can also just commit specific files by using

 git commit <list of files>

more to come…


gitignore file:

A gitignore file specifies intentionally untracked files that git should ignore.  It concerns files that are not tracked by git, and that you don’t want to track with git, so temporary files, results of compilation, compled documentation, etc.  The man page is here.  When git is determining what files to ignore it:

  1. Checks for a relevant command line option
  2. Check patterns from a .gitignore file in the same directory as the path, or in any parent directory.
  3. Check for patterns in $GIT_DIR/info/exclude
  4. Check for patterns in the configuration variable core.excludesfile

The man page describes the patterns, which are anyway pretty close to the usual *nix conventions that you’ll probably just get them right.  As an example, here’s my .gitignore file for a netbeans project:


This tells git to ignore any build or javadoc directories, as well as emacs temporary files.  Taking the time to setup a .gitignore file when you are starting a new project with git will make everything else more convenient down the line.

Collaboration: tracking multiple branches

Because of some wonky security policies on our institute’s network, we can’t directly push and pull from each other, so we go over a central repository. Many of us work on multiple machines, so we want to use the central repository as a convenience tool for synching up between our machines, but we don’t necessarily want out colleagues pulling our work-in-progress. The solution is for each of us to have our own branch. This post tells us how to start a new branch on a remote git repository. The steps are basically:

  1. Create a remote branch. This can be done with the command
     git push origin origin:refs/heads/new_feature_name

    (assuming your remote repository is called origin).

  2. Make sure everything is up to date with
     git fetch origin
  3. Start tracking the new branch with
     git checkout --track -b new_feature_name origin/new_feature_name
  4. Make sure everything is up to date by doing a pull.
    git pull

The third command,

 git checkout --track -b new_branch origin/new_feature_name

is one you’ll run several times, every time you clone a repository somewhere, you’ll want to use to track all the various branches you are interested in. That way you can checkout your colleagues (or bug fix) branches when you like, and merge them into your work whenever it is useful.


Deleting a branch. Okay, so you’ve been branching all over the place, and now you realize you have some dead hanging branches you really don’t want cluttering up your repository anymore.   To get rid of a branch on the remote repository, you’ll want to do the following:

git push origin :head/branch_to_delete

An open letter to Antonio Maria Costa

Antonia Maria Costa, the UN “Drug Czar”, has written a letter to the guardian asking “How many lives would have ben lost if we didn’t have controls on drugs”. It riled me up enough that I had to shoot off a response:

One has to wonder if Mr. Costa believes the nonsense he is promulgating, or he is simply performing his function as a propaganda minister for the prohibition industry to the best of his abilities. Both could reasonably be the case.

He posts the question

How many lives would have been lost if we didn’t have controls on drugs?

and goes on to discuss the current policy of drug prohibition as though “control”, “prohibition”, and “regulation” were synonymous. They are, of course, not. We have systems of control in place for the regulation of of alcohol and tobacco, both of which are significantly more dangerous and more addictive than many drugs which are currently prohibited my most nations (for example Cannabis, LSD, Ecstasy). By comparing the effect of regulation of alcohol against the effect of prohibition of alcohol, we can easily see that we protect our citizenry better through regulation than we do through prohibition. Regulation results in less crime, less overdose, less underage use, in short more control than does prohibition.

The current prohibitionist policies and irrational assessments of drug harm result in a situation that is quite simply out of control, and this is what we in the “legalization chorus” object to. Or does Mr. Costa wish to make the claim that things are in control in, say, Mexico? Or the United States for that matter?

How many lives would have been saved if our children had been obtaining honest information about the relative harms of drugs, rather than dishonest propaganda? How many lives would have been saved if our addicts (I am writing as an American here) could have gotten treatment and counselling for their problems instead of getting labelled as a criminal and ostracised as a criminal? How many lives would have been saved if clean needles were freely available? How many lives have been lost in botched drug raids, in drug violence?

The facts, Mr. Costa, speak against you, and your rhetoric and word-play is too weak to obscure them. Of course we need controls on harmful substances. We in the chorus are not asking you to stop controlling potentially harmful substances. We are asking out governments to regulate them. We simply want sane and rational regulation, rather than jingoistic prohibition.

Exit strategies for the war on drugs, part1: Framing the discussion

I am gradually of the opinion that drug-policy reform is now a sure thing, and the discussion will need to shift to alternative policies.  This is the first in a multi-part series, in which I prattle on about what comes next after the war on drugs.  This post attempts to formulate a useful basis for the discussion of the subject.

The Guardian has an excellent article: Prohibition’s failed. Time for a new drugs policy. The first line sums it up perfectly “”.

It’s clear that the debate now needs to be about what comes next.   We’ve created a stupid war against the citizenry our own country.  It’s completely fucking up our civil liberties, and in fact the entire premise is completely unconstitutional. Argentina’s government has realized this, and if we lived in a healthier democracy, we would have figured out the same thing by now. The good news is we seem to be getting there, so the time for figuring out an exit strategy would seem to be now.

The issues aren’t simple. We have a monstrous police-state machinery in place. We have to pull out the troops and integrate them back into society, and provide them with counselling to reintegrate them into normal society. While this should be an easy sell, as there is a peace-dividend (reduced spending on law-enforcement and prisons, improved civil liberties, reduced crime…) the drug-warriors don’t want to give up sucking at the government teat, and form a powerful lobby. The most difficult question of course is “okay, prohibition doesn’t work, what now?”.

Unfortunately, the people who should be working on this are still too afraid to admit prohibition has failed.  While they get up to speed, the most productive discussions in this arena are taking place online, in in the periphery of other discussions. I’d like to discuss the issue more directly.


So, let’s identify some (hopefully) uncontroversial goals, by which we can judge whether a drug policy is working or not.

  • minimize addiction rates.
  • minimize overdose deaths.
  • protect children and uninformed consumers.
  • minimize crime (e.g. junkies stealing to get their ‘fix’)

There are other effects which are more difficult to quantify, such as health impacts (cancer and such) and effects on productivity. While these are worth considering, I think it’s a reasonable approach to consider them second-order effects. Once we have a policy which optimizes the easily measured first-order effects, we can worry about the second order ones. The key thing to keep in mind here is prohibition is a nightmarish failure, regardless of which effects you consider. It doesn’t accomplish any of the desired effects. The results of prohibition are so disastrously bad, that complete deregulation might end up working just as well, without the enormous cost (socially and economically) of funding the war.

An error the drug warriors make is framing the discussion in terms of “zero-tolerance”.   They want to completely eliminate all drug use.  What the last 100 years has shown is that that won’t happen. You can keep spending more money, you can keep use the constitution as toilet paper after shitting on people’s civil rights, you can get more and more violent and intolerant, you can impose increasingly draconian laws, and people will still use drugs. The figures are there.  It takes enormous cognitive dissonance to deny them, so let’s stop doing

There remains of course the question of how much we are willing to pay to achieve those goals. I suspect that the people who are so willing to spend billions on the drug war, will be less willing to spend the same billions on counselling, care, rehabilitation, education, and maintenance programs. Fortunately, the drug war has been so damned expensive, anything we come up with likely be much more effective at a greatly reduced financial cost.  This will allow us to frame all such harm reduction spending in terms of savings over the prohibitionist approach.

Having identified a set of goals which I hope we can all agree on, let us consider what will be needed to implement a sane drug policy.  It’s my conviction that a good drug policy will involve the following components.

  1. Rational evaluation of drug harm.
  2. Honest drug education.
  3. Honest drug scheduling (a rational classification system).
  4. A sane handling of the respective classes of drugs.
  5. Reality based assessment of policy effects.
  6. More power to states and communities for deciding drug policies.

Each of these points is non-trivial, and will require some discussion.  Thus they will be the subject of future posts.

Some might disagree with necessity of a drug scheduling system at all, and would advocate regulating all drugs like we do alcohol.  While I see some merits to such an extremely libratarian approach,  I would argue against pursuing such a goal for the following reasons:  It’s unrealistic in today’s political climate, it’s too rapid and extreme a change, and I suspect such a policy might be nearly as harmful as the current policy.  If it’s not clear to me, it’s going to be extremely unpalatable for the average citizen.

Keeping the classification system allows to handle the approach in a more reasonable and rationed manner.  We can agree to pursue a policy that accomplished the stated goals, and analyse each drug case by case, based on a rational assessment of its relative harm, made by qualified medical researchers. It also allows us to separate the questions “do we need drug policy reform”, and “what is a good drug policy for drug X”.  The answer to the former question is simple, the answer to the latter is, in some cases, rather difficult.  For example, I am torn on what constitutes a good policy for Heroin or Crack (I do know that current American policies are the wrong answer, but I’m not sure heroin and crack bars are the right answer).

Conclusion and caveats:

To successfully advocate for drug policy reform, I think keeping the above goals in mind is extremely useful.  It provides a concrete, uncontroversial framework for evaluating the failure of current policy, and provides some useful indications for steps in a positive direction.  There may be additional goals which are useful to bring into the discussion, but in the terrible situation we currently find ourselves in, we should strive to work toward unifying, uncontroversial goals.  Once these are acheived, we can open up more controversial, difficult discussions, such as “what right does the government have telling me what I can put in my body anyway”, or the ethical merits of a drug-free lifestyle versus the spiritual benefits of psychotropic drugs.

Advocacy anti-patterns

A few years ago it became quite trendy to attempt to isolate succesful patterns in solving certain recurrent programming problems. Not long thereafter, it became clear that it was useful to identify identify harmful anti-patterns which frequently impede or halt the success of a project. Just as studying such anti-patterns can help the success of a software-engineering project, studying anti-patterns in human behaviour can help us be more successful in our attempts at social-engineering. Among the social issues for which I advocate I have noticed several such anti-patterns, which I will attempt to identify and describe.

The purpose of studying anti-patterns is self-analysis, not to provide a convenient vocabulary for attack within an advocacy group.  Indeed, in-fighting and splintering within an advocacy group is the mother of all advocacy anti-patterns.   I called it the “People’s front of Judea” pattern, and will write about it at a future date.

That said, a  comment at inspired me to write out the first few. The context is this: An editorial was posted discussing how illegal cannabis cultivation is destroying the ecology of our national parks. The article was specifically addressing the impact on Crystal Cave, but the problem is a general one. This is one of the negative consequences of cannabis prohibition, and will disappear once prohibition is repealed. A reader, ( primus) made a comment to the effect that “hey, we should try and get the Sierra club involved in this issue.”, a good point, and useful from an advocacy point of view, as it suggests an approach to bring more people into the cause.

Another reader (“James G”) replies:

I am more than sorry to inform you Primus that with the exception of our public lands,”thank God we do have those, for now” this world is not ours,”the common home of humanity,as it should be” but the” private property” of a small percentage of the human population who thouraghly believe they should be able do anything with their private property they see fit even if the rest of us is harmed.You must understand that these people are in favor of freedom and human wellbeing only to the extent that they can profit directly from such virtues.When freedom and the wellbeing of the 90 plus percent of humanity that does not belong to the ownership class threatens the power and or profits of the elite those virtues are cast aside in favor of totalitarian and facistic acts which insure that the masses never taste real freedom and wellbeing.

The facts are quite clear;the elite will first destroy humanity and the natural enviroment with their arsenals of nukes and biochemical weopons before they will loose or sucsede power to whom power rightfully belongs”,that is the people”.

Indeed this is not our world but the private property of the elite.This is why we now live in an age when a person can be incarcerated for the personal use of a plant ,”in the name of protecting the public wellbeing” while ultra wealthy manufactorers of the most deadly of weopons,”even nukes” walk scott free and enjoy the best life has to offer,all at our expence. It is really quite insane,but yet we still call it civilization !

Apathy of Despair

These three paragraphs can be summarised as “Dude, don’t even try and do anything because everything is so shitty you can’t possibly make it better.”. I like to call this “Apathy of despair.“.

Successful advocacy relies on people being engaged and working actively to a certain goal. People are motivated to work towards social change when they 1) see that there is a problem, and 2) have some hope that the situation can be improved. One often runs into people who start off claiming that there is no problem (apathy of denial). If one confronts these people with sufficient evidence to the contrary they move directly to despair (apathy through despair). What these two states have in common is a lack of action or effort. I get the impression the apathetic individual simply doesn’t want to take responsibility for their role society, and just wants to skate through without making an effort. Some accomplish this abdication of effort through naivite, and others through cynicism, but the result is basically the same.

The overwhelming journey

Laziness is not the only path to the apathy-of-despair. In James case, I believe he arrived there through a pattern of thinking that deserves its own anti-pattern, which I’ll call the “overwhelming journey”.  (I can’t think of a better name yet, but please feel free to make suggestions). The overwhelming journey occurs when an individual sees the problems involved, but can’t see the path to improvement.  They have forgotten that “the journey of a thousand miles begins with single step”.   They may be frustrated because they have forgotten that social change takes time, and is difficult.  Perhaps their frustrations with the problems they perceive leads them to an angry state of mind, and so they are unable to calmly and rationally analyse the problem and possible solutions.  The get wrapped in a ranting, raving, rabid froth.

Some additional gripes

James’ post suffers from some additional anti-patterns, which are difficult to point out in a kindly manner.  He rants and raves about the “elite”, “fascistic act” etc.  Basically he’s falling into the “grand conspiracy” AAP (which is a close corollary to the tinfoil hat AAP).   This kind of thing dilutes a movements credibility, and drives away potentially useful collaborators.

In the end, James post encourages prohibition-repeal advocates to give up and stop giving a shit, and drives people who are undecided on the issue away.