Hi! 

A checkout deleted a partially untracked file. Is there a way to recover 
the file? What did I do wrong?

The problem is likely due to .gitignore being checked in and changing 
across branches:

   - A stub for a new file is created, committed and pushed.
   - The file is added to .gitignore and "git rm --cached file" is executed 
   since only I need that file.
   - Several commits to that branch happen. The file is heavily edited, but 
   ignored by commits as expected.
   - After commit, pull and push; I checkout another (old) branch, which 
   has not seen the commit that changes .gitignore
   - No changes, and I checkout the previous branch again. However, now my 
   file seem irrevocably lost. The remote repository only contains the initial 
   stub for this file, since it was only edited after it was being added to 
   .gitignore

I usually advise my students to check-in their .gitignore file into the 
repository. Apparently this is a bad advice, since it now seemed to have 
led to a file loss. So what is the advice on this? Google turned up mixed 
advice there, but I could not find a reference to my problem described 
above.

Thanks for any advice,
 Steffen.

-- 
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/d/optout.

Reply via email to