git 撤消 Phabricator 中的最后一个差异

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25110277/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:16:14  来源:igfitidea点击:

Undo last diff in Phabricator

gitphabricator

提问by Arnaud

I have an open revision in Phabricator (with Git), and I submitted a diff to this revision, with the arc diffcommand.

我在 Phabricator 中有一个开放修订(使用 Git),并且我使用arc diff命令提交了该修订的差异。

The problem is that this diff is bad, and so I would like to undo it and to come back to the previous diff.

问题是这个差异很糟糕,所以我想撤销它并回到以前的差异。

Do you know how can I do please?

你知道我该怎么办吗?

回答by seato

I often make the mistake of diff'ing against the wrong branch.

我经常犯对错误的分支进行差异化的错误。

The first step is to undo the diff. We can't kill the diff from the revision history, but we can revert it.

第一步是撤消差异。我们不能从修订历史中消除差异,但我们可以恢复它。

$ arc patch --diff <diff_id> # last good diff, creates <arcpatch-branch>
$ arc diff --update <revision_id> <arcpatch-branch> # "reverts" the offending diffs to the current state

At this point your revision is back to its original state. If you want to perform the diff again then do what you normally do. Checkout the branchwith the changes intended for the diff and then perform the diff.

此时,您的修订已恢复到其原始状态。如果你想再次执行差异,那么做你通常做的事情。使用针对 diff 的更改签出分支,然后执行 diff

$ git checkout <new_branch>
$ arc diff <source_branch> # new_branch has changes that is intended to be merged into source_branch

Credit to altendky who listed most of these steps. However, the revisionflag he referenced no longer exists and I also wanted the steps to be listed a bit more clearly.

归功于列出了大部分这些步骤的 altendky。但是,revision他引用的标志不再存在,我还希望将步骤列出得更清楚一些。

回答by altendky

Disclaimer: I have limited Git experience and I am using Phabricator with SVN presently.

免责声明:我的 Git 经验有限,目前我正在使用 Phabricator 和 SVN。

Assuming that you have no other local changes you could revert your working copy then arc patch --diff <diff_id>where the diff ID is shown in the ID column of the Revision Update Historytable. Then just arc diff --revision <rev_id>as usual to update. I suppose it's not technically a delete but so it goes with pseudo-revision-control. The mistake and correction will be tracked.

假设您没有其他本地更改,您可以恢复您的工作副本,然后arc patch --diff <diff_id>差异 ID 显示在Revision Update History表的 ID 列中。然后就arc diff --revision <rev_id>照常更新。我想这在技术上不是删除,而是与伪修订控制相结合。错误和更正将被跟踪。

回答by Evan Priestley

This is not currently supported. You can replace the bad diff with a new, good diff by following the process altendky recommends or any similar process (i.e., just run arc diffagain with your working copy in the correct state).

目前不支持此功能。您可以按照 altendky 推荐的过程或任何类似的过程(即,只需arc diff再次运行处于正确状态的工作副本),用新的、良好的差异替换坏差异。

This is a feature we intend to add eventually. You can follow the progress in the upstream here:

这是我们打算最终添加的功能。您可以在此处跟踪上游的进度:

https://secure.phabricator.com/T1081(Closed as won't fix)

https://secure.phabricator.com/T1081(因无法修复而关闭)