I meant to write about this literally 2+ years ago when I first joined Uber.
Amazon uses git. But when I moved to Microsoft, people are still using source depot and perforce (oh my gosh) and everything is either sd this or p4 that, and we have to “enlist” something instead of “pull”. Later, we moved to git (Microsoft’s own version, I forgot the name), at that time I feel more comfortable, and I was pretty much doing below to keep different branches to do the similar stacked diff thing
git diff hash1 hash2
Luckily, Uber uses Facebook’s Phabricator, where you can simply change the default HEAD view and arc diff with latest head. More details can be found here presented by Kutis at Uber in this post. You need to “arc which ” to know what’s your default relatively commit, sometimes just arc diff hash… and later arc land hash -keep-branch.
However, since phab arc didn’t support arc diff hash1, hash2 like git diff, we can only support one commit diff. That’s why we normally “git rebase -i master”, replay the commit with “edit” or “pick”, you “arc diff xxx -update DiffNumber”, then “git rebase -continue” to finish up the rebase
Finally you are to the point to land your change, yay! Just need to keep in mind you have to keep-branch else you lose your branch (ouch) “arc land sha1 -keep-branch”. Once you are all done and you can “git branch -D your_branch” later
Another way to achieve the same is keeping different branches, written by my coworker Will here. Different roads to Rome, same thing.
Stacked Diffs.pdf