Long story short, a co-worker’s computer crashed and lost his work since his last push. As a last resort, I started thinking about what extent origin is aware of commits before they get pushed from local to origin. If origin is tracking this commits in some temporary location, is there anyway to pull these commits back into the code some how?
Long story short, a co-worker’s computer crashed and lost his work since his last
Share
No. Remotes in git only “track” commits from a different repository through two* mechanisms:
fetch, in which they explicitly request references, andpush, in which references are provided to them from another repository.If the entire local drive is corrupted, and you no longer can salvage the majority of the
.gitdirectory in the repository, you are sadly limited to the normal ways of drive recovery – git can’t help you beyond that. Sorry 🙁If you do have the repository and it’s just gotten into a bad state, the
git reflogcommand could help you, or if you provide more specifics you can do some deeper spelunking of the object database.*There are of course other mechanisms to do this, but they make use of these things and their equivalent plumbings under the hood.