How can I recover main.c and learn Git with Keil?

0
1
Asked By SunnyPebble42 On

Git and Keil are central to my microcontrollers class, but I'm still struggling to understand how they work together. While trying to return my project to the state of my first lab assignment and undo some edits, I accidentally deleted my main.c file. I'm not sure how to recover it or where to start learning the workflow, especially since my professor and TAs avoid giving specific answers that might reveal the lab solutions.

1 Answer

Answered By CopperFox7 On

Your file may still be recoverable. Run `git reflog` to see previous positions of HEAD, including before the reset or checkout. Once you find the commit containing the file, restore just main.c with `git checkout -- main.c` or the newer equivalent, `git restore --source= -- main.c`. Avoid running `git clean -fd` until you’re sure you don’t need any untracked files, since that can permanently remove them.

SunnyPebble42 -

Thanks, I wasn’t sure where to look after the file disappeared. I’ll check the reflog before trying anything else.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.