212

Typing svn log spits out an incredibly long, useless list on a command line. I have no idea why that is the default. If I wanted to read (or even could read) 300 entries on the terminal, I wouldn't mind typing svn log --full or something similar.

Perhaps the SVN guys are thinking I wanted to feed that output to another program. However, if that is the case, it would make more sense to have the more verbose call for the program - not the terminal user.

Anyway, how do I see just some recent activity like the last 5 or 10 entries to see what changed?

1
  • 11
    Yeah, it really should work like, um, git log. Aug 24, 2014 at 3:49

9 Answers 9

280

limit option, e.g.:

svn log --limit 4

svn log -l 4

Only the last 4 entries

135

Besides what Bert F said, many commands, including log has the -r (or --revision) option. The following are some practical examples using this option to show ranges of revisions:

To list everything in ascending order:

svn log -r 1:HEAD

To list everything in descending order:

svn log -r HEAD:1

To list everything from the thirteenth to the base of the currently checked-out revision in ascending order:

svn log -r 13:BASE

To get everything between the given dates:

svn log -r {2011-02-02}:{2011-02-03}

You can combine all the above expressions with the --limit option, so that can you have a quite granular control over what is printed. For more info about these -r expressions refer to svn help log or the relevant chapter in the book Version Control with Subversion

2
  • 8
    Many thanks for that explanation, @Daniel Dinnyes - I often have the opposite problem from the OP: svn log . may return only the earliest revision for me (likewise with svn log --limit 4 .); but if I call svn log -r HEAD:1 ., then I finally get all entries listed... Thanks again - cheers!
    – sdaau
    Nov 18, 2011 at 20:39
  • This is better, since svn log only show the change history of current path.
    – Ninja
    Aug 25, 2016 at 7:40
43

I like to use -v for verbose mode.
It'll give you the commit id, comments and all affected files.

svn log -v --limit 4

Example of output:

I added some migrations and deleted a test xml file
------------------------------------------------------------------------
r58687 | mr_x | 2012-04-02 15:31:31 +0200 (Mon, 02 Apr 2012) | 1 line Changed
paths: 
A /trunk/java/App/src/database/support    
A /trunk/java/App/src/database/support/MIGRATE    
A /trunk/java/App/src/database/support/MIGRATE/remove_device.sql
D /trunk/java/App/src/code/test.xml
3
  • 3
    The verbose option is extremely useful Sep 2, 2012 at 21:03
  • And if the dev-team is really sweet they put the issue id in the svn comment and you can easily find the issue connected to the commit. Mar 18, 2013 at 11:47
  • Yes, @JasonGeorge, I also like -v option
    – Steven Lee
    Oct 25, 2021 at 2:24
11

Pipe the output through less or other pager:

svn log | less
1
  • 1
    If you have > 23k revisions, you'll still wait ~20 seconds to see the first entries (and when not using verbose log). But it's nice - shows most recent at the top. And better than TortoiseSVN's 100-at-a-time paging! When you want to go further back. Nov 14, 2012 at 20:42
7

In case anybody is looking at this old question, a handy command to see the changes since your last update:

svn log -r $(svn info | grep Revision | cut -f 2 -d ' '):HEAD -v

LE (thanks Gary for the comment)
same thing, but much shorter and more logical:

svn log -r BASE:HEAD -v

1
  • 10
    or just svn log -r BASE:HEAD -v
    – Gary
    Jan 21, 2015 at 0:07
5

To add to what others have said, you could also create an alias in your .bashrc or .bash_aliases file:

alias svnlog='svn log -l 30 | less'

or whatever you want as your default

5

But svn log is still in reverse order, i.e. most recent entries are output first, scrolling off the top of my terminal and gone. I really want to see the last entries, i.e. the sorting order must be chronological. The only command that does this seems to be svn log -r 1:HEAD but that takes much too long on a repository with some 10000 entries. I've come up this this:

Display the last 10 subversion entries in chronological order:

svn log -r $(svn log -l 10 | grep '^r[0-9]* ' | tail -1 | cut -f1 -d" "):HEAD
5

This answer is directed at further questions regarding Subversion subcommands options. For every available subcommand (i.e. add, log, status ...), you can simply add the --help option to display the complete list of available options you can use with your subcommand as well as examples on how to use them. The following snippet is taken directly from the svn log --help command output under the "examples" section :

Show the latest 5 log messages for the current working copy
directory and display paths changed in each commit:
  svn log -l 5 -v
4

As you've already noticed svn log command ran without any arguments shows all log messages that relate to the URL you specify or to the working copy folder where you run the command.

You can always refine/limit the svn log results:

  • svn log --limit NUM will show only the first NUM of revisions,
  • svn log --revision REV1(:REV2) will show the log message for REV1 revision or for REV1 -- REV2 range,
  • svn log --search will show revisions that match the search pattern you specify (the command is available in Subversion 1.8 and newer client). You can search by
    • revision's author (i.e. committers username),
    • date when the revision was committed,
    • revision comment text (log message),
    • list of paths changed in revision.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.