2018/01/05

Git Tricks .. fsck

This week I was working on sorting out an issue and once I had wrapped it up I went to push all of my changes upsteam. Due to frustration, lazyness and something I'd done over the holiday's when I was done I checked our upstream repo and discovered that the work to sort the issue was not pushed.

In addition, locally my commit's had also vanished from "git log" and I could not find them anywhere. After a few minutes of bashing my head against the wall I turned to google and it took a few moments to craft the right search but I found an article that led me to "git fsck --lost-found"

As soon as I read the statement the words "fsck" and "lost-found" lightened my mood.

The output of the command shared a list of git commit's that had become detached from any branch and I was then able to checkout the orphaned commit, found my files and merged it back to my working branch.

There are many articles out there describing how this works and you can search yourself but here is the "official man page"