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

Pauli Virtanen pav@iki...
Wed Sep 15 10:07:52 CDT 2010

Wed, 15 Sep 2010 15:09:30 +0200, Gael Varoquaux wrote:
> 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.

Suppose you just messed up `somebranch`. First, check its reflog:

    $ git reflog show somebranch

and pick a state that seems good, usually somebranch@{1} if you didn't do 
new commits etc. on the branch yet:

    $ git checkout somebranch@{1}
    ... check now that this is the state you'd like somebranch to have...
    $ git branch -f somebranch somebranch@{1}

which moves `somebranch` to its previous state.

Note that 

    $ git reflog

does *NOT* show the reflog of the current branch -- it shows the reflog 
of HEAD, which can in some cases be confusing. The point is that HEAD is 
a meta-branch that corresponds to the current checkout, and so changes 
every time you use "git checkout".

Pauli Virtanen

More information about the NumPy-Discussion mailing list