[git-users] Changes to files have gone missing

2013-08-06 Thread nick . tuckett
I'm part of a small group of developers using git locally for our SCM, and 
sharing a remote repository on GitHub.

In the last couple of days, one developer noticed that changes he had 
previously committed and pushed to GitHub were no longer present in HEAD; 
the files had either reverted to an earlier version or disappeared 
altogether if they were new.

We've been digging around and scratching our heads to try and work out what 
has gone wrong and why and where, but haven't been able to work this out. 
If anyone has seen anything similar or has any advice, we'd really like to 
know!

Many thanks in advance.

This is what we do know:
* The changes were successfully committed locally to the master branch (no 
detached HEAD involved) and pushed to GitHub.
* The commits for these changes are present if you look at the repository 
history, but not if you look at the default history of the file(s) 
themselves.
* The commits do appear in the individual file logs if you use 
--full-history
* There are no later commits that modify these files - i.e. no merge from 
another user that might overwrite the changes.
* If you checkout the relevant commit (which should be the latest version 
of the file) you can see the changes.
* If you then checkout HEAD, the changes disappear.
* This state of the repository is present both on local repos and on GitHub.

What we don't know:
* Where this situation arose - on the original developer's machine, another 
developer's machine or on GitHub.
* Why it arose.
* How to avoid it in future.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [git-users] Changes to files have gone missing

2013-08-06 Thread Philip Oakley
Sorry about the top posting - HTML/Outlook difficulties...

Given that you have found the commit sha1, and you can see the reflogs, you 
should be able to see what the next action was after the commit, which should 
give you a clue as to what happened.

You didn't say what interface/gui you used (do tell - different interfaces give 
different user characteristics). If it was bash (etc.) you can look at its 
history to see which commands were issued.

The other place to check is your config files. You could have a forced update 
fetch (plus sign '+' in front of the ref name) which meant that when you 
interchanged data with github your local branch 'head' pointer (to your lost 
commit) got overwritten by another commit that was at the head on github.

Once you have the sha1 of that missing commit then start a new feature branch 
that points directly at it and you are good to go. Only when you checkout that 
(new) branch will you actually see those changes in your worktree. This can be 
a shock (not being able to see you local changes) if you are/were used to older 
SCMs where you checked out files and then checked them back in - Git only does 
whole work trees (by default) - so if you had swapped branches, or 'reset 
--hard', then your changes appear to simply disappear (git knows they are 
available within the commit sha1 so doesn't think it is a data loss problem).

You may need to update your workflow to cope with the 'power' of git. This 
should be used for learning, rather than any blame
e.g. not working on 'master', rather work on feature branches and then merge 
them when complete, especially if working in a team (group1)..

Philip
  - Original Message - 
  From: nick.tuck...@marmalademail.com 
  To: git-users@googlegroups.com 
  Cc: William Bell ; Luan Bach ; David Hunt 
  Sent: Tuesday, August 06, 2013 2:12 PM
  Subject: [git-users] Changes to files have gone missing


  I'm part of a small group of developers using git locally for our SCM, and 
sharing a remote repository on GitHub.


  In the last couple of days, one developer noticed that changes he had 
previously committed and pushed to GitHub were no longer present in HEAD; the 
files had either reverted to an earlier version or disappeared altogether if 
they were new.


  We've been digging around and scratching our heads to try and work out what 
has gone wrong and why and where, but haven't been able to work this out. If 
anyone has seen anything similar or has any advice, we'd really like to know!


  Many thanks in advance.


  This is what we do know:
  * The changes were successfully committed locally to the master branch (no 
detached HEAD involved) and pushed to GitHub.
  * The commits for these changes are present if you look at the repository 
history, but not if you look at the default history of the file(s) themselves.
  * The commits do appear in the individual file logs if you use 
--full-history
  * There are no later commits that modify these files - i.e. no merge from 
another user that might overwrite the changes.
  * If you checkout the relevant commit (which should be the latest version of 
the file) you can see the changes.
  * If you then checkout HEAD, the changes disappear.
  * This state of the repository is present both on local repos and on GitHub.


  What we don't know:
  * Where this situation arose - on the original developer's machine, another 
developer's machine or on GitHub.
  * Why it arose.
  * How to avoid it in future.

  -- 
  You received this message because you are subscribed to the Google Groups 
Git for human beings group.
  To unsubscribe from this group and stop receiving emails from it, send an 
email to git-users+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
   
   

  No virus found in this message.
  Checked by AVG - www.avg.com
  Version: 2013.0.3392 / Virus Database: 3209/6554 - Release Date: 08/05/13

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.