[Numpy-discussion] Can we freeze the subversion repository and move to github this week?

Benjamin Root ben.root at ou.edu
Wed Sep 15 10:10:08 EDT 2010


On Wed, Sep 15, 2010 at 8:09 AM, Gael Varoquaux <
gael.varoquaux at normalesup.org> wrote:

> On Wed, Sep 15, 2010 at 09:54:24PM +0900, David Cournapeau wrote:
> > The basic way to use reflog is trivial: it just keeps a (time ordered)
> > list of your commits and actions, independently of the branch. So for
> > example, say you are in master, and by accident, you do:
>
> > git reset --hard origin/master # origin/master is behind master
> > git reflog
>
> > will look like:
>
> > b59aa8c HEAD@{0}: origin/master: updating HEAD
> > ad5c0c0 HEAD@{1}: pull github master: Fast forward
> > d11b913 HEAD@{2}: commit: ENH: add builder override support for
> > compiled libraries.
> > 2423a03 HEAD@{3}: commit: FEAT: add get_compiled_libraries to get all
> > clib from all subpackages.
> > ae4c57b HEAD@{4}: merge tmp: Fast forward
> > f4c4b53 HEAD@{5}: github/master: updating HEAD
> > ae4c57b HEAD@{6}: checkout: moving from tmp to master
> > ae4c57b HEAD@{7}: checkout: moving from
> > ae4c57bab5583759aab831eafce0c9b83a5f9c45 to tmp
> > ...
>
> I don't understand which line corresponds to the 'reset --hard' in the
> above reflog (sorry, I am slow). Is it the 'updating HEAD' one?
>
> Reading the above, it seemed to me that I could always revert my previous
> action (unless it impacted non-tracked files) using:
>
>    git checkout HEAD@{0}
>
> I just tried it on a copy of a repo I had, and I get "You are in a
> 'detached HEAD'". From what I understand from the message (and Google) I
> simply need to do a "git checkout -b new_branch" to be in a state where I
> can work. However, it seem to me that when I switch back the the master
> branch, and merge my new_branch, I haven't "undone" the action I was
> trying to undo.
>
> Sorry for asking these questions, but I'd rather be dense and ask them
> while I am playing with a toy repo than suffer from my git inability
> later on a real situation, which usually happens at 2AM.
>
> Thanks for you git-foo
>
> Gaël
>

I have to ditto the earlier sentiment about how easy it is to mess up in git
(as compared to svn).  I read the git parable and (I thought) I understood
the elegance of how git works, only to later discover that there was still
plenty of details that I just "didn't get".  It is probably a good thing
that we are cutting our teeth on toy repositories first.

Anyway, I would just like to voice two of the most important things I have
learned about git.  First, 'git revert' != 'svn revert' (seriously, Linus...
why?).

Second, 'git stash' is your friend.  If you haven't come across stash yet,
here is a quick use-case.  Imagine you are working on adding a particular
feature and have made some changes.  Along the way, you discover an
unrelated bug.  You can 'stash' the changes you made so far, reverting back
to the state at the last commit, and then fix that bug.  You then commit
*that* bugfix (to the proper branch, of course), then you can 'pop' the
stashed changes and be back to where you were when you did the stash (with
the bugfix).  Lovely feature... :)

Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100915/bb7b0181/attachment.html>


More information about the NumPy-Discussion mailing list