Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
398 views
in Technique[技术] by (71.8m points)

phabricator - Can you arc diff against a particular git branch?

I'm pretty new to both Arcanist and git. I'd like to be able to create an arc diff (Phabricator Differential instance using Arcanist) against a git branch that I'm currently checked-out/working in (and I have one local un-pushed commit) rather than the master. To me the arc docs are unclear on this. Is it possible? How? It would be nice if the answer works for 2-3 local un-pushed commits as well.

Also "arc help diff" gives:

      diff [paths] (svn)
      diff [commit] (git, hg)
          Supports: git, svn, hg
          Generate a Differential diff or revision from local changes.

          Under git, you can specify a commit (like HEAD^^^ or master)
          and Differential will generate a diff against the merge base of that
          commit and HEAD.

Maybe I just need to do "arc diff [commit]" where [commit] is the tip of the target branch? But I'd like to be certain, because I don't want to pollute our Phabricator instance.

Also, I'm happy to receive "you're doing it wrong" answers if the answer explains how to do it right.

question from:https://stackoverflow.com/questions/19819252/can-you-arc-diff-against-a-particular-git-branch

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In general, arc diff <branch> will do what you want. (If you're already on the branch, rather than a local topic branch, try arc diff origin/<branch> instead.)

When invoked like this, arc will actually diff against the merge-base of the branch's tip and the current commit in the working copy, but generally this is what you intend. If you really want to generate a diff against the branch tip you can use arc diff --base git:<branch>, but this diff will include changes which undo any commits on the branch which are descendants of the branch point, just like git diff <branch>..HEAD would.

In all cases, you can use arc which <commit> to preview what arc diff will do. This will explain which revision range would be selected, show you the command to see exactly which changes are included, and explain why that range is selected.

You can also use arc diff --preview to generate just a diff, without sending it for review. This will let you preview changes before submitting them to anyone else.

See also:

https://secure.phabricator.com/book/phabricator/article/arcanist_commit_ranges/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...