Search code examples
gitdiffgit-diff

Git diff between current modification and another ref


I would like to display the diff between my current work (in a dirty state) and another branch.

I can do:

$ git diff my_other_branch

Unfortunately the diff is reversed: I would like to exchange the ref (like git diff a..b => git diff b..a.

Any solution?


Solution

  • There are multiple ways to deal with this, but the simplest is to use the -R (reverse the diff orientation) option to git diff.