.

Getting The Hang Of Git |

I signed up for GitHub (More for the tracking than anything) - I still had to sort out a git repo for the code I don’t want out there in the wild.

Turned out to be pretty straight forward ( Good Instructions or Even better ones if you like packages)

Looks like gitosis was really the key. The only problem I ran into was my main server is still a Debian sarge box - ( Yes I know that’s old. Yes it annoys the crap out of me since every other box I deal with is actually an Ubuntu box. Yes I’m waiting for Hardy Haron to make a clean start of it.) I had to pull in a lot of packages from either etch or testing (1.5.4 is in testing). Not ideal but it works for now.

I actually spent the last three days in the UK and while I was there I had very limited internet connectivity. No big deal - I did a bunch of work in a git repo locally. Now that I’m back home I’d prefer to make sure that the code isn’t just on my laptop (Backups are nice - so is my home workstation). I was able to easily add the new repo to my new git server. No problem.

Example from the above articles:
mkdir free_monkey
git init
git remote add origin git@YOUR_SERVER_HOSTNAME:free_monkey.git
Add in some files - blank repos are no longer pushable
git push origin master:refs/heads/master

On my workstation I just did
git clone git@YOUR_SERVER_HOSTNAME:free_monkey.git
cd free_monkey

If I need to add a new repo - or a new user - I can just

git clone git@YOUR_SERVER_HOSTNAME:gitosis-admin.git
cd gitosis-admin

Very nice!

Then I hit a small wall - basically I was in the middle of some feature work. I had two different branches off of trunk - one related to a new feature that is still a day away from being finished - and a strain of development related to migrating the app to Rails 2.0.x. It wasn’t obvious what the hell to do. Basically you have local branches and remote branches. I’ve obviously master local branches - now how the hell do I get them to be remote.

Then I found this overall guide Git Guide - SourceMage Wiki

on my laptop (with the branches - and after I had commited master)

git co rails-2.0.x
git push origin rails-2.0.x:refs/heads/rails-2.0.x

on my workstation (update/get list/create local branch)
git pull
git branch -r
git branch --track rails-2.0.x origin/rails-2.0.x

(Apparently if I ever need to delete the remote branch I just do this)

git branch -r -d origin/rails-2.0.x

This is all a little bit confusing - but I’m sure once I get the hang of it I’ll end up adding some global aliases to make like easier. All this power and no ability to replicate the functionality of svn:externals - the mind boggles.

One Response to 'Getting The Hang Of Git'
  1. Pieter de Bie:

    You can also push new branches just with a “git push origin rails-2.0.x”.
    Also, tracking branches are the default nowadays, so you don’t need to specify –track anymore.

Leave a Reply

Moderation Active: Old stuff here... Therefore your comment on this post will be moderated (i.e. don't submit twice !)

    Categories
    Archives

    .