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

David Cournapeau cournape@gmail....
Wed Sep 15 07:54:24 CDT 2010


On Wed, Sep 15, 2010 at 8:48 PM, Gael Varoquaux
<gael.varoquaux@normalesup.org> wrote:
> On Wed, Sep 15, 2010 at 06:55:46PM +0900, David wrote:
>> > Unless you use the 'force' switches. I am trying very hard not to
>> > use them, as I have been advised by several good git users.
>
>> Well, yes and no. For example, you can not loose commits with any
>> command that I know of thanks to the reflog (and this is true even if
>> you use really "hard" commands like git reset --hard somecommit).
>
> Cool, very handy. I wasn't aware of this. Is there a GUI for reflog (in
> any one of the many GUIs, I don't really care)? I don't use reflog much
> because I don't understand it, and don't really know what operations I
> can do on it (still learning).

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
...

So you know exactly how to go back any point in time - that is until
the reflog is "purged" (which is something like 30 days by default I
think).

The key point is that any operation you do in git w.r.t. commits is
moving in the graph, so resetting, checking out, etc... do not lose
anything. In particular, reset --hard only get you back to some node
of that graph, without removing the old one. That's also useful when
you need to revert some merge, etc... Although, as mentioned by pv, it
does not preclude doing potentially "harming" operations in separate
branches (if only because it is simpler).

cheers,

David


More information about the NumPy-Discussion mailing list