Re: [git-users] recover added file
- Original Message - From: Sharan Basappa To: Git for human beings Sent: Tuesday, May 31, 2016 4:13 PM Subject: [git-users] recover added file Folks, As I make changes to my files, I have been adding them to git repo but haven't been committing them. Today, due to an incorrect switch to the tool, I ended up overwriting a file I was working on. This file was added in repo today. Is there a way to recover that file? Yes, but it requires a little effort on the users part. Git will not delete any of its stoired objects until either commanded, or it has become un-referenced for a reasonable amout of time (configurable) and the garbage collection (gc) has kicked in. Have a search for "git lots and found loose blob" for pertenant hits. Most will deal with lost commits, but all types of objects can be found. There is a Stack Overflow question oin this very issue $SO/q/1108853/717355. -- Philip -- 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.
Re: [git-users] recover added file
> > > > As I make changes to my files, I have been adding them to git repo > > but haven't been committing them. > > Today, due to an incorrect switch to the tool, I ended up overwriting > > a file I was working on. > > This file was added in repo today. Is there a way to recover that > > file? > > git checkout -- path/to/the/file > > will grab the contents of the file "path/to/the/file" as recorded in > the index and create/overwrite it in the work tree with that contents. > > Should you run something like > > git checkout HEAD path/to/the/file > > then the contents would be taken from the tip commit (HEAD) instead of > the index. Thanks -- 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.
Re: [git-users] recover added file
On Tue, 31 May 2016 08:13:15 -0700 (PDT) Sharan Basappawrote: > As I make changes to my files, I have been adding them to git repo > but haven't been committing them. > Today, due to an incorrect switch to the tool, I ended up overwriting > a file I was working on. > This file was added in repo today. Is there a way to recover that > file? git checkout -- path/to/the/file will grab the contents of the file "path/to/the/file" as recorded in the index and create/overwrite it in the work tree with that contents. Should you run something like git checkout HEAD path/to/the/file then the contents would be taken from the tip commit (HEAD) instead of the index. -- 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.
[git-users] recover added file
Folks, As I make changes to my files, I have been adding them to git repo but haven't been committing them. Today, due to an incorrect switch to the tool, I ended up overwriting a file I was working on. This file was added in repo today. Is there a way to recover that file? Thanks, -- 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.