git 在 Egit 中恢复
是否可以在 Egit 中执行“git revert”,通过创建新提交来回滚更改(而不是签出旧提交或进行硬重置,而硬重置不会创建新提交来回滚更改)?
如果您有一个中央存储库,以防您需要撤消已推送到那里的更改,这似乎是一个重要的功能。
提前致谢!
Is it possible to do "git revert"s in Egit to rollback changes by creating a new commit (as opposed to checking out an older commit or doing a hard reset which doesn't create a new commit rolling back the changes)?
This seems like an important feature if you have a central repository in case you ever need to undo changes that has already been pushed there.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
--
马蒂亚斯
--
Matthias
如果您认为此 5 天前提交,名为“合并“实施恢复命令””(Shawn Pearce),似乎很快就会推出。
差异在这里 :
If you consider this commit from 5 days ago, called ' Merge "Implement a revert command" ' (Shawn Pearce), it seems it will be available soon.
The diff are here:
由于声誉较低,我无法发表评论,但我想将最后一部分添加到 @Matthias Sohn 的答案中,以防万一像我这样的人通过搜索如何执行此操作找到此内容。他的步骤如下,因此您不必滚动:
这将在历史视图顶部添加一个条目“恢复[先前提交评论]”。如果右键单击这个新条目,您将看到一个用于提交恢复操作的选项。您需要从“历史记录”视图中执行此操作,因为正如@Lennon 所说,您无法从“包资源管理器”中提交和推送。
此方法的缺点是它将恢复提交中的所有更改。我希望能够仅回滚变更集中的特定文件,因此如果有人知道执行此操作的方法,请添加。
I can't comment due to low reputation, but I wanted to add the final piece to @Matthias Sohn's answer just in case anyone, like me, finds this via searching for how to do this. His steps are here below so you don't have to scroll:
This will add an entry at the top of the history view "Revert [previous commit comment]". If you right click this new entry you will see an option to commit the Revert operation. You need to do it from the History view because as @Lennon said, you cannot commit and push from the Package Explorer.
The downside to this method is it will Revert all changes in the Commit. I would prefer to be able to rollback only a specific file that was in a Changeset, so if anyone knows of a way to do this please add on.
右键单击要恢复的文件 ->替换为 ->头部修订
Right click file which you want to revert -> Replace With -> HEAD revision