Sara Chipps Sara Chipps - 5 months ago 28
Git Question

Possibly lost some changes via git

The other day I was trying to push some changes to the remote server.

I kept getting an error so I looked to see what branch I was on.

I saw that I was un an undefined branch locally, which was really freaking weird so I checked out master and then was able to push.

Just checked out the merge and none of my changes were there. They aren't here locally. 10+ hours of work, and I can't find it anywhere.

I did a gitk and I don't see any of my changes. I do see a merge of master that looks like this:

Author: Sara Chipps <sarajchipps@Sara-Chippss-MacBook-Pro.local> 2012-01-04 13:48:20
Committer: Sara Chipps <sarajchipps@Sara-Chippss-MacBook-Pro.local> 2012-01-04 13:48:20
Parent: 1a294db3a244d7aeaafbc99c986af86ce7cf17da (Merge branch 'master' of
Parent: 8ed995c7a5a370333ab27485be07f6a5f647e8d4 (added subscription button to edit profile section)
Child: 0dbf7e53737c0e7ee7ab908812299c1d60ef0c46 (removed coffee icon on getting started)
Branches: master, remotes/origin/master

Merge branch 'master' of

I am not the only one committing to this project, I don't know how I got on an undefined branch locally. Can anyone suggest a fix? Worried about losing a lot of work.

thank you.



git reflog

That will give you a history of operations, and if your changes were checked in, they'll be in a revision somewhere in that log.

You might also look at the output from:

git rev-list --all --header HEAD

This will show a large chunk of what's in the repository. You may need to work with -n to limit, and the output is a bit confusing. Have a look at the man page for git-rev-list for additional information. This will hopefully help figure out where you are.

You can also create a branch at the current location:

git branch my temporary

Then use gitk

gitk --all

to get an idea too.