开发者

Accidentally recovered deleted files

I just caused a problem that I'm having trouble finding a solution for. I have been working on a year old Ruby On Rails app, which is stored in a Git repository.

I deleted many files, several commits ago, but never did a git 开发者_如何学JAVArm filename to remove the files from the repository.

Recently I did a git stash save --keep-index, git stash drop to discard some bad code and go back to the last commit. However when I did this, the deleted files which were not removed from the repository have been restored.

Now my project is crashing because of files that exist, which should not. Is there any way I can re-delete the files, or get a list of the deleted files which were restored?

I tried googling this problem, but google helpfully returns results for "git restore accidentally deleted files" which is the opposite of what I am looking for.


A stash becomes a commit node in the graph, and just because you dropped it doesn't mean it's gone forever. It'll be garbage collected eventually, but as long as you dropped it relatively recently, you should be able to find it and add it back into your "regular" history as either a stash or a commit. Just look around for how to recover dropped stashes or how to find dangling/lost commits. Something like this, this, or this, perhaps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜