I had changed a file a decent amount, and wanted to see what changed since the last commit. My changes were not commited.
I used git checkout /path/to/file and successfully grabbed the file from my last commit.
Is there any way to go back to the uncommited work I had added, or is that lost forever?
Thanks
When you checkout a file, it overwrites the file meaning that it is gone.
In the future, use git diff to see what has changed. Using git diff with no arguments will show all changes from the directory you're in or you can do git diff /path/to/file for the diff of just that file.
Unfortunately, yes, you have probably lost it forever.
You'll have to write that code again.
Next time, when you want to do something like this, you may use git stash. Type git help stash to see what it does. Or as @Lekensteyn suggested, git show may be even better.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With