05/11/2008

Git fork

I have decided to try and work on EGit (the git plugin for eclipse) in my spare time. First I have to grok git and that's proving harder than anticipated.

Now when I say version control I have a couple basic expectations:

  • I want it to be easy to get a workspace
  • I want it to be easy to publish my changes

So "the get a workspace" is easy with git :

$>git clone @projecturl clone #clone is the destination directory
$>cd clone
$clone>git branch -a
* master
origin/HEAD
origin/master
origin/stable

There you have your workspace.

Now editing master directly is not recommanded. you should make a local branch to work on your modifications and of course checkout this branch

$clone>git branch master work
$clone>git checkout work

(note that you can actually create the new branch as part of the checkout by using the -b argument)

Now I want the "publish my changes" part and that's not quite as straightforward ... Heading to the documentation tells me :

$clone>git push @sshurl master:master

but that seems like a lot of typing if I'm going to do it frequently. (not as frequently as commit but still ... Going further down gives me :

$clone>cat >>.git/config << EOF
[remote "public-repo"]
  url = @sshurl
  fetch = +refs/heads/*:refs/remotes/origin/*
EOF

yeah right, this makes the command [irony]soooo much smaller[/irony]

$clone> git push published master

but I am really lazy I want to only have to do "git push" so let's have a look at .git\config :

$clone>cat .git\config
[core]
  repositoryformatversion = 0
  filemode = false
  bare = false
  logallrefupdates = true
  symlinks = false
  ignorecase = true
[remote "origin"]
  url = @projecturl
  fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
  remote = origin
  merge = refs/heads/master
[remote "public-repo"]
  url = ssh://yourserver.com/~you/proj.git
  fetch = +refs/heads/*:refs/remotes/origin/*

Here goes my solution :

$clone>cat >>.git/config << EOF
[branch "work"] 
  remote =public-repos
  merge = refs/heads/master
EOF

Now you can just do git push from your "work" branch to your public repository!

[rant]why do I have to update the config file by hand for such an obvious use case ... go figure ![rant]

République & Démocratie

La loi HADOPI, ou encore Le projet de loi « Création et Internet » ça fait rèver. je ne télécharge plus de musique depuis longtemps il y a d'autres moyens plus sûrs de s'en procurer surtout maintenant que deezer est là. Mais cette loi ne fait que me rappeller que les définitions de République et de Démocratie ne sont pas identiques. Mais voyons cela de plus près :

Démocratie: Le terme démocratie désigne un corpus de principes philosophiques et politiques, suivant lequel un groupe social donné organise son fonctionnement par des règles : élaborées, décidées, mises en application et surveillées par l'ensemble des membres de ce groupe, a priori sans privilèges ni exclusions. République: La république est une des formes constitutionnelle de l'État, qui se conçoit comme consubstantiel du peuple. Toute république doit donc être comprise, définie et fondée par opposition aux conceptions monarchiques ou théocratiques de l'État et de la Nation.

Merci wikipedia (un indicie : consubstantiel => ayant la même substance).