Thursday, August 23, 2012

relocating a git repository

Recently I started creating a new project, with the amazing name 'alchemy'. Sadly it turned out that this name was already taken on google code. So to start working on it I had to create a temporary project on google code and once I managed to get my greedy fingers on the others project name (successful I might add!) ...

...I had now the challenge to move my dozen or so lines of codes over to the new repository.

Now I'm the first one to admit, I'm still kinda green with 'git' and have only used it in the past on 1 or 2 little project and never on anything real. So how complicate will it be to move the code and not loose your complete history of commit (all 7 of them...)

Surprisingly easy it turns out, just issue the following magic commands and you are all set.

  1. git remote add alchemy https://code.google.com/p/alchemy/
  2. git push alchemy master
  3. git remote rm origin
  4. git remote add origin https://code.google.com/p/alchemy/
  5. git remote rm alchemy
Now looking at this, I'm quite sure I could had simplified this even more, but for now it got the job done.