Johnny [Life & Code]

Semper Exploro!

GIT – The `cool thing` in a developer’s toolbox

with 2 comments


I wish i had known GIT a few months back. It would have saved me form a lot of trouble (loosing half done work ..). Well this post is _not_ a (yet another) GIT tutorial.

Some of the workflows i like (and use) is something like this :

Interrupted workflow (taken from git-reset man page)
Suppose you are interrupted by an urgent fix request while you are in the middle of a large change. The files in your working tree are not in any shape to be committed yet, but you need to get to the other branch for a quick bugfix.
$ git checkout feature ;# you were working in "feature" branch and
$ work work work       ;# got interrupted
$ git commit -a -m 'snapshot WIP'                 (1)
$ git checkout master
$ fix fix fix
$ git commit ;# commit with real log
$ git checkout feature
$ git reset --soft HEAD^ ;# go back to WIP state  (2)
$ git reset                                       (3)

Isn’t that wonderful ! I was trying out svn + quilt. But very hard to manage.

Some resources :

My GIT Ref Card :

# Initialize a repo (like git init):
git-svn init http://svn.foo.org/project/trunk
# Fetch remote revisions:
git-svn fetch
# Create your own branch to hack on:
git checkout -b my-branch remotes/git-svn
# Merging in master.
git merge --squash foo-branch-name
# Do some work, and then commit your new changes to SVN, as well as
# automatically updating your working HEAD:
git-svn dcommit
# Something is committed to SVN, rebase the latest into your branch:
git-svn fetch && git rebase remotes/git-svn

GIT is fast (super fast) ! and git-svn helps you if you are _stuck_ with svn !

Now GIT has moved out of my ‘staging area’ to everyday use. Yay!! I use it for GNOME/Evolution (and GNOME just moved to SVN a few months back😉 )

Written by Johnny

October 30, 2007 at 8:40 pm

2 Responses

Subscribe to comments with RSS.

  1. You may be interested in git-stash, it provides the same functionality maybe in an more fashionable (and easier to remember) way!

    Stéphane Bisinger

    September 26, 2008 at 5:39 pm

  2. Yep ! I’m using git-stash now .. nice one !

    Johnny

    September 27, 2008 at 2:01 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: