Git恢复错误消息? [英] Git Revert Error Message?
问题描述
在尝试恢复对我的.emacs.d文件夹的存储库中的提交时,我收到以下消息:
haziz @ haziz> git revert 7fe3f
错误:无法从ubuntu恢复7fe3f0b ... .emacs.d内容hp 15
提示:解决冲突后,标记修正后的路径
hint: 'git add< paths>'或'git rm< paths>'
hint:并提交结果'git commit'
我正在尝试做的是对我的init.el文件进行的反向更改,并且后面跟着另一个我正在尝试反转的提交。我宁愿复原而不复位 - 因为据我所知,后者完全消除了最近的提交。我想创建一个新的提交,以便我可以恢复回复。
换句话说,我正在试图做的是这个
Git Commits [A] ... [B]
会被还原为
Git Commits [A] ... [B] .. [A']
我做错了什么?
编辑:我试着做一个差异/合并,因为我可以接受另一个提交,但它仍然给我这个新的错误信息:
haziz @ haziz> git revert 7fe3f0ba3182b591f11c0b59e006dc6c990b7470
致命错误:您的本地更改将被恢复覆盖。
请提交您的更改或隐藏它们继续。
如何告诉它忽略(但不删除)unstaged文件,而不使用.gitigore文件。我坦率地说并不关心大多数非临时文件,它们是emacs临时文件等。
Q。有什么冲突?
合并反向补丁修改版本时,后来的修订版本改变了相同的代码行:合并冲突
$ b
编辑如果您要还原 latest 提交,这意味着您有本地更改(请参阅
git status
)。不要忘记,您可以进行暂存和未暂存本地更改。要轻松查看所有本地更改,请使用
git diff HEAD
您应该打开未合并文件( git status
)以查看冲突的文件。你会看到<<<<< / code>,
=====
,>>>>>< / code>冲突标记即将到来。您可以使用
git mergetool
解决与更多用户友好的工具(如Meld,KDiff3,Gvim等)冲突。
While trying to revert a commit I made to my repository of my .emacs.d folder I get the following message:
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'
What I am trying to do is reverse changes I made to my init.el file and have followed with another commit which I am trying to reverse. I would prefer to revert rather than reset --hard since as far as I know the latter completely erases the most recent commit. I would like to create a new commit so that I can possibly "revert" the revert.
In other words what I am trying to do is this
Git Commits [A]...[B]
would be reverted to
Git Commits [A]...[B]...[A']
Am I doing something wrong?
Edit: I tried doing a diff/merge as best as I could then another commit but then it still gives me this new error message:
haziz@haziz> git revert 7fe3f0ba3182b591f11c0b59e006dc6c990b7470
fatal: Your local changes would be overwritten by revert.
Please, commit your changes or stash them to proceed.
How do I tell it to ignore (but not delete) unstaged files, without resorting to a .gitigore file. I frankly don't care about most of the unstaged files which are emacs temp files etc.
Q. What conflict?
The conflict from merging the reverse patch of that revision, when later revisions changed the same lines of code: a merge conflict
Edit If you are reverting the latest commit, this means that you had local changes (refer to
git status
). Don't forget that you can have staged and unstaged local changes. To easily see all local changes, usegit diff HEAD
You should just open up the unmerged file (git status
) to see the conflicted file(s). You'll see the <<<<
, =====
, >>>>>
conflict markers soon enough.
You can use
git mergetool
to resolve the conflicts with more user-friendly tools like Meld, KDiff3, Gvim etc.
这篇关于Git恢复错误消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!