131

I'm using Subversion via the Linux command line interface.

I want to see the difference between revision 11390 and 8979 of a specific file called fSupplierModel.php in my terminal. How can I do that?

codeforester
  • 39,467
  • 16
  • 112
  • 140
allen213
  • 2,267
  • 2
  • 15
  • 21
  • Add here is how to apply it back: https://stackoverflow.com/questions/10333712/how-to-make-and-apply-svn-patch – Vadzim Dec 19 '17 at 08:11

2 Answers2

184

See svn diff in the manual:

svn diff -r 8979:11390 http://svn.collab.net/repos/svn/trunk/fSupplierModel.php
bahrep
  • 29,961
  • 12
  • 103
  • 150
D'Arcy Rittich
  • 167,292
  • 40
  • 290
  • 283
  • 3
    If you want pretty output, install [colordiff](http://www.colordiff.org) and add ` | colordiff` to the end of the above command to pipe everything through it. – William Turrell Sep 28 '16 at 19:25
66

To compare entire revisions, it's simply:

svn diff -r 8979:11390


If you want to compare the last committed state against your currently saved working files, you can use convenience keywords:

svn diff -r PREV:HEAD

(Note, without anything specified afterwards, all files in the specified revisions are compared.)


You can compare a specific file if you add the file path afterwards:

svn diff -r 8979:HEAD /path/to/my/file.php

ahnbizcad
  • 10,491
  • 9
  • 59
  • 85
  • 2
    putting HEAD:PREV seemed to make more sense to me in the diff output, maybe will help others – Fonix Dec 02 '16 at 02:27
  • @Fonix are you in the paradigm of "how does another commit differ from my current state"? If so, I agree. I usually think of chronological changes commits, so changes made in HEAD would have been the new/added changes from PREV, which is the paradigm I usually think in. There are cases and arguments to be made for either paradigm. – ahnbizcad Jul 05 '18 at 17:31
  • when you do git diff, it shows you what you added relative to a previous commit. PREV:HEAD makes more sense, but this is one of those things where some people prefer inverting the up and down controls for a joystick or trackpad. subjective idiosyncratic preference. – ahnbizcad Mar 10 '21 at 19:32
  • weirdly enough, i am one of those people who use an inverted mouse when playing FPS games :P – Fonix Mar 15 '21 at 14:38
  • that would explain it :P – ahnbizcad Jun 03 '21 at 20:04