Skip to content

Instantly share code, notes, and snippets.

@spsneo
Forked from zackdever/gist:8701478
Created December 14, 2018 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spsneo/6361517f0c135afc8481303465928093 to your computer and use it in GitHub Desktop.
Save spsneo/6361517f0c135afc8481303465928093 to your computer and use it in GitHub Desktop.
arc diff off another diff
taken directly from https://sites.google.com/a/khanacademy.org/forge/for-developers/code-review-policy/using-phabricator
Advanced topic: Dependent Phabricator reviews
Say you have an upstream called master, and a feature branch F1, and a second change that depends on F1, (call it F2).
git checkout master
git checkout -b F1
# work work
git commit -a
arc diff
git checkout -b F2 # Note that F1 is set as the upstream of F1
# work work
git commit -a
arc diff # arc will now check to see diffs against the upstream, so only the change from F1 to F2 will be posted
Now let's say you had issues in F1 from a review and you need to update the Phabricator diff.
git co F1
# fix the stuff
git commit -a --amend
arc diff # upload updated patch
git co F2
git rebase -i F1 # rebase the contents of F2 on top of the *new* F1. You should only select the actual change on F2
F1 has set its upstream to master. So let's say you want to land F1. After landing F1, you'll want to rebase F2 onto master and change its git upstream to master.
git co master
git pull
git co F1
git rebase master
arc land --onto master # this lands F1. at this point, F2's upstream has disappeared. we need to fix that
git co F2
git branch --set-upstream-to=master # Now F2's upstream is master, since we landed F1!
git rebase -i master
Now, F2 is like a normal branch pointed to master. arc diff uses the upstream to determine the diff to upload to the server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment