【发布时间】:2012-01-07 02:00:03
【问题描述】:
在尝试恢复我对 .emacs.d 文件夹的存储库所做的提交时,我收到以下消息:
haziz@haziz> git revert 7fe3f
error: could not revert 7fe3f0b... .emacs.d contents from ubuntu hp 15
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
我想要做的是反向更改我对 init.el 文件所做的更改,然后是我试图反向的另一个提交。我宁愿恢复而不是重置 --hard 因为据我所知后者完全删除了最近的提交。我想创建一个新的提交,以便我可以“还原”还原。
换句话说,我想做的就是这个
Git Commits [A]...[B]
将恢复为
Git Commits [A]...[B]...[A']
我做错了吗?
编辑:我尽我所能尝试进行差异/合并,然后再次提交,但它仍然给我这个新的错误消息:
haziz@haziz> git revert 7fe3f0ba3182b591f11c0b59e006dc6c990b7470
fatal: Your local changes would be overwritten by revert.
Please, commit your changes or stash them to proceed.
我如何告诉它忽略(但不删除)未暂存的文件,而不使用 .gitigore 文件。坦率地说,我并不关心大多数未暂存的文件,例如 emacs 临时文件等。
【问题讨论】:
-
Git 告诉你该怎么做:解决冲突
-
git status会告诉你。
标签: git git-revert