3

In Phabricator/Arcanist, there is a command arc diff --preview which lets you see all your code changes in a nice UI before you send it off to code review (see https://secure.phabricator.com/book/phabricator/article/arcanist_diff/ for more details).

What's the equivalent to this in Git?

Michael
  • 776
  • 4
  • 19
  • 1
    That would likely be a pull request on a git hosting service like github. Otherwise you’ll be looking for something using `git diff` – evolutionxbox Jan 26 '18 at 21:49
  • Is there a way to preview what the pull request would look like without actually pushing my local branch to remote? – Michael Jan 26 '18 at 21:55
  • I only know of using the terminal commands. As for a “nice UI” I have no clue. – evolutionxbox Jan 26 '18 at 21:59
  • You probably want `git diff mybranch origin/master` (there are many git UIs, I'm sure most of them will have an equivalent for this). – match Jan 26 '18 at 22:25
  • Possible duplicate of [How can I preview a merge in git?](https://stackoverflow.com/questions/5817579/how-can-i-preview-a-merge-in-git) – max630 Jan 27 '18 at 15:12
  • 1
    This is the feature I missed the most when I switch from Phabricator to Github – Harry Su Jun 11 '20 at 00:11

1 Answers1

0

I recently migrated a massive mono-repo from Phabricator to Github and sadly there is no equivalent to arc diff --preview for Github. The best equivalent I've found to share your changes without actually creating a pull request / submitting your code for review is to create a new remote branch, push your changes there and share the link to your commit on the remote branch.

Say you're on master, this can be a simple flow

git checkout -b dev--preview

# make your changes on this branch

git add . && git commit -m "Previewing changes" && git push -u origin dev--preview

# copy the last commit id
git rev-parse HEAD | pbcopy

Your shareable link is going to be of this format

https://www.github.com/<org-name>/<repo-name>/commit/<your commit SHA from your clipboard>
sbrk
  • 1,338
  • 1
  • 17
  • 25