Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reverse the git diff output for uncommitted changes?

Tags:

git

git-diff

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

like image 658
puio Avatar asked Feb 01 '26 03:02

puio


1 Answers

git diff -R

-R means "reverse".

like image 81
phd Avatar answered Feb 02 '26 17:02

phd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!