Skip to content

Instantly share code, notes, and snippets.

@astrolemonade
Forked from Whoaa512/Stacked-diff-steps.md
Created September 28, 2023 08:05
Show Gist options
  • Save astrolemonade/13fecac9666cc0fb92c6397ea2a31915 to your computer and use it in GitHub Desktop.
Save astrolemonade/13fecac9666cc0fb92c6397ea2a31915 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment