Skip to content

Instantly share code, notes, and snippets.

@Whoaa512
Last active September 28, 2023 08:05
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save Whoaa512/1d265ce8c09add70f432a6ad8ebc6b28 to your computer and use it in GitHub Desktop.
Save Whoaa512/1d265ce8c09add70f432a6ad8ebc6b28 to your computer and use it in GitHub Desktop.
Cheatsheet for the stacked diffs workflow in phabricator at Fictiv

stack diff steps

  1. Checkout & pull latest master
git checkout master && git pull --rebase origin master
  1. Cut branch from master
arc branch stacked_feature_1
  1. Make changes, add commits
# ...change, change, change
git add .
git commit
  1. Diff against master
arc diff
  1. Push the stacked_feature_1 branch to github. (Note: this is important so that the following diffs can be patched in the test build for jenkins)
git push origin stacked_feature_1
  1. Cut branch from stacked_feature_1
arc branch stacked_feature_2
  1. Make changes, add commits
# ...change, change, change
git add .
git commit
  1. Diff against stacked_feature_1
arc diff stacked_feature_1
  1. [optional] Verify branch status
arc branch
  1. Steps 5-9 can be repeated for as needed
  2. If commits or changes need to be made on stacked_feature_1
git checkout stacked_feature_1
# ...change, change, change
git add .
git commit
arc diff

11.1 Now we need to update our next branch (Note: this would need to be repeated for each branch that was cut from this)

git checkout stacked_feature_2
git pull
  1. If commits or changes need to be made on stacked_feature_2, we need to make sure we diff against the same branch that we cut from
# ...change, change, change
git add .
git commit
arc diff stacked_feature_1
  1. When it comes time to land things, there are 2 rules we must follow.
    1. We must land in the same order that we cut in, or in FIFO order -- first in, first out
    2. And we land with --keep-branch so that the following lands don't break
git checkout stacked_feature_1
arc land --keep-branch
git checkout stacked_feature_2
# You may need to rebase from your upstream branch and then rebase master before landing
git pull --rebase . stacked_feature_1
git pull --rebase origin master
arc land --keep-branch --revision DXXX # Where DXXX is the diff id from stacked_feature_1
@gnydick
Copy link

gnydick commented Apr 2, 2022

OMG, OMG, OMG. I know I seem crazy, but this is nothing different than any other PR like strategy. There's just a shiny facade on it. All of the work to keep things in sync is the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment