Undo last diff in Phabricator

Arnaud picture Arnaud · Aug 4, 2014 · Viewed 19.9k times · Source

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

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?

Answer

seato picture seato · Jun 8, 2017

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 branch with the changes intended for the diff and then perform the 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 revision flag he referenced no longer exists and I also wanted the steps to be listed a bit more clearly.