Search code examples
gitgit-diff

How to reverse the git diff output for uncommitted changes?


I have some uncommitted, unstaged changes which I want to create a patch from, but also flip the + and - lines.

git diff shows a change like:

-apple
+orange

I want it to be like

+apple
-orange

but without committing the changes and then using a git diff commita..commitb


Solution

  • git diff -R
    

    -R means "reverse".