简体   繁体   English

git从本地未提交的更改中恢复已删除的文件

[英]git restore deleted files from uncommited changes in local

I have uncommitted changes in my local branch (development2) and there were some file that were inadvertently deleted. 我在本地分支(development2)中未提交更改,并且有一些文件被无意删除。 I was restoring the files back into my local with the following command: 我正在使用以下命令将文件还原到本地:

git checkout -- /path/to/my/files

I was copying and pasting each individual file using this command, unfortunately I ran the command 我正在使用此命令复制和粘贴每个文件,不幸的是我运行了该命令

git checkout --

which brought back all the files, which I did not want to do, I wanted to go through and bring back specific files. 它带回了所有我不想做的文件,我想遍历并带回特定的文件。 I still have not committed my changes, is there a way I can fix this? 我仍未提交更改,是否有办法解决此问题?

If you have done git add FILE_YOU_WANT at lease once, git reflog might help you. 如果您一次完成git add FILE_YOU_WANT租借git add FILE_YOU_WANT ,那么git reflog可能会为您提供帮助。

If no, no hope... 如果没有,没有希望...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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