139

Using the SVN command line, is there a way to show the last X number of commits along with commit messages, in reverse-chronological order (newest commit first)?

Ishmaeel
  • 14,138
  • 9
  • 71
  • 83
Lokesh Dhakar
  • 5,289
  • 5
  • 22
  • 24

4 Answers4

195
svn log --limit 10

or

svn log -l 10

Further googling uncovered the answer. svn log lists in reverse-chronological order by default.

Trufa
  • 39,971
  • 43
  • 126
  • 190
Lokesh Dhakar
  • 5,289
  • 5
  • 22
  • 24
  • 17
    SVN has really useful built-in help. `svn help log` would probably be even faster than a Google search. – user229044 Apr 20 '10 at 14:13
  • 3
    This command seems to return only the last but one(not the latest) commit messages. For eg the latest commit is r901 but it returns only till r900. Just wanted to check if this was the standard or an error. Also `svn log -l10 ` would return the latest(r901) also. – Shyam K Dec 05 '12 at 04:38
  • This isn't the right answer, this wont show the latest commits, and that could be very misleading. – Owl Dec 04 '20 at 03:15
27

To clarify the previous answers - note that svn log by default only shows the commits up to the revision of your working copy (latest svn update, run svn info to see). So yes, if it's OK for you to download all commits first, this combination will work:

svn update

svn log -l 10

However, I'm mostly interested in showing the ALL latest commits without first updating my working copy, so I mostly compare my log to HEAD falling:

svn log -l 10 -r HEAD:1

It makes a huge difference to me.

Paul Rooney
  • 20,879
  • 9
  • 40
  • 61
Jens X Augustsson
  • 1,214
  • 12
  • 13
24

A shortcut -l exists for --limit

# show last 10 logs
svn log -l 10
BuZZ-dEE
  • 6,075
  • 12
  • 66
  • 96
svassr
  • 5,538
  • 5
  • 44
  • 63
22

To see them in chronological order:

svn log -r1:HEAD
yegor256
  • 102,010
  • 123
  • 446
  • 597