简体   繁体   中英

Using Git for Windows - Accidentally lost a ton of work. Can I get it back?

I am so confused and I think I've lost hours of work.

I was editing a file in Git earlier, and I saved it, but did not commit. I did do a few other file changes, and commited and pushed them. However, one file was messed up, so I clicked on the last successful commit, and pressed "roll back to this commit." To my horror, it erased all my uncommitted changes, and now I have no idea how to get them back since they were not committed.

You say that you didn't commit it. Unfortunately git only saves commits and not undone work. So, as sorry as I am, there is no way to use git to get your work back.

But you could try to restore the deleted files .

You might also want to have a look at this coding horror post.

You could now (March 2013) check, with GitHub for Windows, if you can undo a "Rollback":

See " Undo Button in GitHub for Windows "

we've added Undo support for Discards, Commits, Rollbacks, and Merges :

撤消按钮

I don't know if the rollback would save your unstaged and uncommitted changes though, so that new "Undo" button might not be a good enough solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM