大理 网站建设,试述网站开发的流程,福州鼓楼区网站建设,建个微商城网站多少钱场景1#xff1a;修改了文件/path/to/file#xff0c;没有提交#xff0c;但是觉得改的不好#xff0c;想还原。 解决#xff1a; git checkout -- /path/to/file
场景2#xff1a;修改了文件/path/to/file#xff0c;已经提交#xff0c;但是觉得改的不好#xff0c…场景1修改了文件/path/to/file没有提交但是觉得改的不好想还原。 解决 git checkout -- /path/to/file
场景2修改了文件/path/to/file已经提交但是觉得改的不好想还原到上衣版本。 解决
首先查看文件的历史版本。git log /path/to/file找到你想要还原的版本。如 commit 052c0233bcaef35bbf6e6ebd43bfd6a648e3d93b Author: panww panwwgmail.com Date: Wed Nov 8 11:48:31 2017 0800 commit modify/path/to/file将文件还原到你想要还原的版本。$ git checkout ${commit} /path/to/file。即$ git checkout 052c0233bcaef35bbf6e6ebd43bfd6a648e3d93b /path/to/file这时查看文件会发现文件已经还原了。如果没有还原请刷新再看。commit、push。
ps 网上看到可以通过$ git reset ${commit} /path/to/file来还原。在Windows下使用Git Bash工具亲测不可用。