<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>svn diff</title><link rel="stylesheet" href="styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><link rel="start" href="index.html" title="Version Control with Subversion" /><link rel="up" href="svn.ref.svn.html#svn.ref.svn.c" title="svn Subcommands" /><link rel="prev" href="svn.ref.svn.c.delete.html" title="svn delete" /><link rel="next" href="svn.ref.svn.c.export.html" title="svn export" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">svn diff</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="svn.ref.svn.c.delete.html">Prev</a> </td><th width="60%" align="center"><span class="command"><strong>svn</strong></span> Subcommands</th><td width="20%" align="right"> <a accesskey="n" href="svn.ref.svn.c.export.html">Next</a></td></tr></table><hr /></div><div class="refentry" lang="en" xml:lang="en"><a id="svn.ref.svn.c.diff"></a><div class="titlepage"></div><a id="id416278" class="indexterm"></a><div class="refnamediv"><h2>Name</h2><p>svn diff — Display the differences between two revisions or paths.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="id416303"></a><h2>Synopsis</h2><pre class="programlisting">diff [-c M | -r N[:M]] [TARGET[@REV]...]</pre><pre class="programlisting">diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] [PATH...]</pre><pre class="programlisting">diff OLD-URL[@OLDREV] NEW-URL[@NEWREV]</pre></div><div class="refsect1" lang="en" xml:lang="en"><a id="id416328"></a><h2>Description</h2><p>Display the differences between two paths. The ways you can use <span class="command"><strong>svn diff</strong></span> are:</p><p>Use just <span class="command"><strong>svn diff'</strong></span>to display local modifications in a working copy.</p><p>Display the changes made to <em class="replaceable"><code>TARGET</code></em>s as they are seen in <em class="replaceable"><code>REV</code></em> between two revisions. <em class="replaceable"><code>TARGET</code></em>s may be all working copy paths or all <em class="replaceable"><code>URL</code></em>s. If <em class="replaceable"><code>TARGET</code></em>s are working copy paths, <em class="replaceable"><code>N</code></em> defaults to <code class="literal">BASE</code> and <em class="replaceable"><code>M</code></em> to the working copy; if <em class="replaceable"><code>URL</code></em>s, <em class="replaceable"><code>N</code></em> must be specified and <em class="replaceable"><code>M</code></em> defaults to <code class="literal">HEAD</code>. The “<span class="quote">-c M</span>” option is equivalent to “<span class="quote">-r N:M</span>” where <code class="literal">N = M-1</code>. Using “<span class="quote">-c -M</span>” does the reverse: “<span class="quote">-r M:N</span>” where <code class="literal">N = M-1</code>.</p><p>Display the differences between <em class="replaceable"><code>OLD-TGT</code></em> as it was seen in <em class="replaceable"><code>OLDREV</code></em> and <em class="replaceable"><code>NEW-TGT</code></em> as it was seen ain <em class="replaceable"><code>NEWREV</code></em>. <em class="replaceable"><code>PATH</code></em>s, if given, are relative to <em class="replaceable"><code>OLD-TGT</code></em> and <em class="replaceable"><code>NEW-TGT</code></em> and restrict the output to differences for those paths. <em class="replaceable"><code>OLD-TGT</code></em> and <em class="replaceable"><code>NEW-TGT</code></em> may be working copy paths or <em class="replaceable"><code>URL[@REV]</code></em>. <em class="replaceable"><code>NEW-TGT</code></em> defaults to <em class="replaceable"><code>OLD-TGT</code></em> if not specified. “<span class="quote">-r N</span>” makes OLDREV default to N, -r N:M makes <em class="replaceable"><code>OLDREV</code></em> default to <em class="replaceable"><code>N</code></em> and <em class="replaceable"><code>NEWREV</code></em> default to <em class="replaceable"><code>M</code></em>.</p><p>Shorthand for <span class="command"><strong>svn diff --old=OLD-URL[@OLDREV] --new=NEW-URL[@NEWREV]</strong></span></p><p><span class="command"><strong>svn diff -r N:M URL</strong></span> is shorthand for <span class="command"><strong>svn diff -r N:M --old=URL --new=URL</strong></span>.</p><p><span class="command"><strong>svn diff [-r N[:M]] URL1[@N] URL2[@M]</strong></span> is shorthand for <span class="command"><strong>svn diff [-r N[:M]] --old=URL1 --new=URL2</strong></span>.</p><p>If <em class="replaceable"><code>TARGET</code></em> is a URL, then revs N and M can be given either via the <code class="option">--revision</code> or by using “<span class="quote">@</span>” notation as described earlier.</p><p>If <em class="replaceable"><code>TARGET</code></em> is a working copy path, then the <code class="option">--revision</code> option means:</p><div class="variablelist"><dl><dt><span class="term"><code class="option">--revision N:M</code></span></dt><dd><p>The server compares <em class="replaceable"><code>TARGET</code></em>@<em class="replaceable"><code>N</code></em> and <em class="replaceable"><code>TARGET</code></em>@<em class="replaceable"><code>M</code></em>.</p></dd><dt><span class="term"><code class="option">--revision N</code></span></dt><dd><p>The client compares <em class="replaceable"><code>TARGET</code></em>@<em class="replaceable"><code>N</code></em> against working copy.</p></dd><dt><span class="term">(no <code class="option">--revision</code>)</span></dt><dd><p>The client compares base and working copies of <em class="replaceable"><code>TARGET</code></em>.</p></dd></dl></div><p>If the alternate syntax is used, the server compares <em class="replaceable"><code>URL1</code></em> and <em class="replaceable"><code>URL2</code></em> at revisions <em class="replaceable"><code>N</code></em> and <em class="replaceable"><code>M</code></em> respectively. If either <em class="replaceable"><code>N</code></em> or <em class="replaceable"><code>M</code></em> are omitted, a value of <code class="literal">HEAD</code> is assumed.</p><p>By default, <span class="command"><strong>svn diff</strong></span> ignores the ancestry of files and merely compares the contents of the two files being compared. If you use <code class="option">--notice-ancestry</code>, the ancestry of the paths in question will be taken into consideration when comparing revisions (that is, if you run <span class="command"><strong>svn diff</strong></span> on two files with identical contents but different ancestry you will see the entire contents of the file as having been removed and added again).</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="id416695"></a><h2>Alternate Names</h2><p>di</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="id416705"></a><h2>Changes</h2><p>Nothing</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="id416715"></a><h2>Accesses Repository</h2><p>For obtaining differences against anything but <code class="literal">BASE</code> revision in your working copy</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="id416732"></a><h2>Options</h2><pre class="screen"> --revision (-r) ARG --change (-c) ARG --old ARG --new ARG --depth ARG --diff-cmd CMD --extensions (-x) "ARGS" --no-diff-deleted --notice-ancestry --summarize --force --username USER --password PASS --no-auth-cache --non-interactive --config-dir DIR --changelist ARG --xml </pre></div><div class="refsect1" lang="en" xml:lang="en"><a id="id416746"></a><h2>Examples</h2><p>Compare <code class="literal">BASE</code> and your working copy (one of the most popular uses of <span class="command"><strong>svn diff</strong></span>):</p><pre class="screen"> $ svn diff COMMITTERS Index: COMMITTERS =================================================================== --- COMMITTERS (revision 4404) +++ COMMITTERS (working copy) </pre><p>See what changed in the file <code class="literal">COMMITTERS</code> revision 9115:</p><pre class="screen"> $ svn diff -c 9115 COMMITTERS Index: COMMITTERS =================================================================== --- COMMITTERS (revision 3900) +++ COMMITTERS (working copy) </pre><p>See how your working copy's modifications compare against an older revision:</p><pre class="screen"> $ svn diff -r 3900 COMMITTERS Index: COMMITTERS =================================================================== --- COMMITTERS (revision 3900) +++ COMMITTERS (working copy) </pre><p>Compare revision 3000 to revision 3500 using “<span class="quote">@</span>” syntax:</p><pre class="screen"> $ svn diff http://svn.collab.net/repos/svn/trunk/COMMITTERS@3000 http://svn.collab.net/repos/svn/trunk/COMMITTERS@3500 Index: COMMITTERS =================================================================== --- COMMITTERS (revision 3000) +++ COMMITTERS (revision 3500) … </pre><p>Compare revision 3000 to revision 3500 using range notation (you only pass the one URL in this case):</p><pre class="screen"> $ svn diff -r 3000:3500 http://svn.collab.net/repos/svn/trunk/COMMITTERS Index: COMMITTERS =================================================================== --- COMMITTERS (revision 3000) +++ COMMITTERS (revision 3500) </pre><p>Compare revision 3000 to revision 3500 of all files in <code class="filename">trunk</code> using range notation:</p><pre class="screen"> $ svn diff -r 3000:3500 http://svn.collab.net/repos/svn/trunk </pre><p>Compare revision 3000 to revision 3500 of only three files in <code class="filename">trunk</code> using range notation:</p><pre class="screen"> $ svn diff -r 3000:3500 --old http://svn.collab.net/repos/svn/trunk COMMITTERS README HACKING </pre><p>If you have a working copy, you can obtain the differences without typing in the long URLs:</p><pre class="screen"> $ svn diff -r 3000:3500 COMMITTERS Index: COMMITTERS =================================================================== --- COMMITTERS (revision 3000) +++ COMMITTERS (revision 3500) </pre><p>Use <code class="option">--diff-cmd</code> <em class="replaceable"><code>CMD</code></em> <code class="option">-x</code> to pass arguments directly to the external diff program</p><pre class="screen"> $ svn diff --diff-cmd /usr/bin/diff -x "-i -b" COMMITTERS Index: COMMITTERS =================================================================== 0a1,2 > This is a test > </pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="svn.ref.svn.c.delete.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="svn.ref.svn.html#svn.ref.svn.c">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="svn.ref.svn.c.export.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">svn delete </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> svn export</td></tr></table></div></body></html>