With Git 2.38+ (Q3 2022), you can use quickly check if there will be conflicts between your feature branch and the PR target branch, using git merge-tree --write-tree
:
git merge-tree --write-tree --no-messages --name-only branch1 branch2
With a GUI like GitHub Desktop (for remote GitHub repositories), you actually can, since March 2023:
In GitHub Desktop 3.1, we introduced viewing the diff of changes across multiple commits.
This allows you to be certain there are no unintended changes in the group of commits you are about to push.
Taking that feature to the next level, GitHub Desktop 3.2 allows you to “Preview your Pull Request”– see a diff of all the changes being introduced by your feature branch into your repository’s default branch.
GitHub Desktop helps you feel confident in your Git workflows, and now we want to help you feel confident in your GitHub workflows as well.
Preview your pull request
If you find yourself apprehensive to push your changes up to GitHub.com and open a pull request, you will like the confidence boost reviewing your pull request locally will give you.
Have you ever submitted a pull request only to find you’ve accidentally left in a debugger statement, requiring you to return back to your local environment, remove the debugger, commit, and push up the change? This can be annoying, time consuming, and maybe even a little embarrassing.
Now with the “Preview Pull Request” feature, you can see the diff of all the changes brought in from all the commits on your feature branch before opening your pull request. It lets you do that double-checking before leaving your local development environment.
