From: "Ben Chang" <>
Hi, hope someone can help ... I'm very confused ...

I'm using git-gui on windows.  I created a new file in my project
source directory.  I'm fond of it - in fact it is the successful
culmination of months of work - so I decide I want to keep it.  I fire
up Git-Gui.  My new file is in the list of Unstaged Changes.  Over on
the right, in the yellow highlighted line, it helpfully points out
that the file is local and not currently tracked.  I click it or do
something or other, I don't really know what, and it's now down in the
list of Staged Changes (green). Yay.  I commit,

Have a look in the reflog for the step where you commiited the file (time for firing up the 'bash' window and some typing;-). It should give you the sha1 value for the commit. Assuming this is still in your own local repo (which it should be unless you actively pruned it), you can check out that sha1 commit. It will be a 'detached head' i.e. you won't be on any branch.

Having checked it out and confirmed it is what you expected, create a new branch (you can even tell git the point at which you want the new branch to split from current branch), and then you can commit the current state (which has the lost commit state) onto the new branch.

Then it's time to read up on your local 'fast forward' policies, and the man page explanations. Hope this helps.

but when I try to push
I get an error about non-fast-forward changes with the suggestion to

git-gui has no "pull" command but I've been assuming that Remote-
Fetch From->origin == pull.  It says I'm up-to-date.  Push still does
nothing.  I spend some time trying to read more about git on the
internets.  Nothing seems relevant, and most of the git commands seem
to be called something else in git-gui.  Frustrated, I go out and hire
a monkey to randomly press buttons for a while, figuring that since an
analytical approach isn't giving good results I'll try a Monte Carlo
method. Monkey pokes around and tries Branch->Checkout->Tracking
Branch->origin/master which of course reverts my local files to what's
on our main project server repository, and I can't figure out how to
get them back.

My cryptic notes from the last time this happened to me, last month,

git branch
git checkout b409bdf

git checkout -b newbranch
git checkout master
git merge newbranch
git branch -d newbranch
git push

because the deleted file was in non-tracked-branch-limbo which can be
found by that magic number there, but this time I can't find it.
argh!  where are my files?

You received this message because you are subscribed to the Google Groups "Git for 
human beings" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to