[clug] "git" hints?

Tony Breeds tony at bakeyournoodle.com
Thu Nov 13 04:07:06 GMT 2008


On Thu, Nov 13, 2008 at 02:51:40PM +1100, Alex Satrapa wrote:

> Here's one thing I could do:
>
> git commit -m "Implementation in progress"
>    -> commit d3adb33f
> git checkout HEAD^ .             # rewind to before the changes I just  
> saved
> git checkout -b FancyNewFeature  # switch to a new branch for fiddling

Well you can do the same thing with:
git commit -m "Implementation in progress"
git branch foo.save
git checkout -b FancyNewFeature HEAD^

This does the same thin except the is a named branch for you WIP.  You
can switch to it at any stage and the commit will not get garbage
collected (which will happen with your approach).

Then as long as:
 a) You collegues knwo that anyhting other then the master branch is WiP
 and isn't to be tested  or;
 b) You only push the master branch to the shared repo
everything will be okay.
>
> This means that my commit d3adb33f is still in the repository and I can 
> return to it at any time, so my work is not lost:
>
> git checkout master
>
> ... but I'm sure there's a better way. Any suggestions?
>
> Also, how much trouble am I going to get myself into with this shell  
> function:

I think you'll be okay as the checkout ont work if the workign tree is
dirty.

Yours Tony

  linux.conf.au    http://www.marchsouth.org/
  Jan 19 - 24 2009 The Australian Linux Technical Conference!



More information about the linux mailing list