14bdef2939066625da2e8d2ca3c90601411aad4f
   1git-svn(1)
   2==========
   3
   4NAME
   5----
   6git-svn - bidirectional operation between a single Subversion branch and git
   7
   8SYNOPSIS
   9--------
  10'git-svn' <command> [options] [arguments]
  11
  12DESCRIPTION
  13-----------
  14git-svn is a simple conduit for changesets between a single Subversion
  15branch and git. It is not to be confused with gitlink:git-svnimport[1].
  16They were designed with very different goals in mind.
  17
  18git-svn is designed for an individual developer who wants a
  19bidirectional flow of changesets between a single branch in Subversion
  20and an arbitrary number of branches in git.  git-svnimport is designed
  21for read-only operation on repositories that match a particular layout
  22(albeit the recommended one by SVN developers).
  23
  24For importing svn, git-svnimport is potentially more powerful when
  25operating on repositories organized under the recommended
  26trunk/branch/tags structure, and should be faster, too.
  27
  28git-svn mostly ignores the very limited view of branching that
  29Subversion has.  This allows git-svn to be much easier to use,
  30especially on repositories that are not organized in a manner that
  31git-svnimport is designed for.
  32
  33COMMANDS
  34--------
  35--
  36
  37'init'::
  38        Creates an empty git repository with additional metadata
  39        directories for git-svn.  The Subversion URL must be specified
  40        as a command-line argument.
  41
  42'fetch'::
  43
  44Fetch unfetched revisions from the Subversion URL we are
  45tracking.  refs/remotes/git-svn will be updated to the
  46latest revision.
  47
  48Note: You should never attempt to modify the remotes/git-svn
  49branch outside of git-svn.  Instead, create a branch from
  50remotes/git-svn and work on that branch.  Use the 'commit'
  51command (see below) to write git commits back to
  52remotes/git-svn.
  53
  54See '<<fetch-args,Additional Fetch Arguments>>' if you are interested in
  55manually joining branches on commit.
  56
  57'commit'::
  58        Commit specified commit or tree objects to SVN.  This relies on
  59        your imported fetch data being up-to-date.  This makes
  60        absolutely no attempts to do patching when committing to SVN, it
  61        simply overwrites files with those specified in the tree or
  62        commit.  All merging is assumed to have taken place
  63        independently of git-svn functions.
  64
  65'rebuild'::
  66        Not a part of daily usage, but this is a useful command if
  67        you've just cloned a repository (using gitlink:git-clone[1]) that was
  68        tracked with git-svn.  Unfortunately, git-clone does not clone
  69        git-svn metadata and the svn working tree that git-svn uses for
  70        its operations.  This rebuilds the metadata so git-svn can
  71        resume fetch operations.  A Subversion URL may be optionally
  72        specified at the command-line if the directory/repository you're
  73        tracking has moved or changed protocols.
  74
  75'show-ignore'::
  76        Recursively finds and lists the svn:ignore property on
  77        directories.  The output is suitable for appending to
  78        the $GIT_DIR/info/exclude file.
  79
  80--
  81
  82OPTIONS
  83-------
  84--
  85
  86-r <ARG>::
  87--revision <ARG>::
  88
  89Only used with the 'fetch' command.
  90
  91Takes any valid -r<argument> svn would accept and passes it
  92directly to svn. -r<ARG1>:<ARG2> ranges and "{" DATE "}" syntax
  93is also supported.  This is passed directly to svn, see svn
  94documentation for more details.
  95
  96This can allow you to make partial mirrors when running fetch.
  97
  98-::
  99--stdin::
 100
 101Only used with the 'commit' command.
 102
 103Read a list of commits from stdin and commit them in reverse
 104order.  Only the leading sha1 is read from each line, so
 105git-rev-list --pretty=oneline output can be used.
 106
 107--rmdir::
 108
 109Only used with the 'commit' command.
 110
 111Remove directories from the SVN tree if there are no files left
 112behind.  SVN can version empty directories, and they are not
 113removed by default if there are no files left in them.  git
 114cannot version empty directories.  Enabling this flag will make
 115the commit to SVN act like git.
 116
 117repo-config key: svn.rmdir
 118
 119-e::
 120--edit::
 121
 122Only used with the 'commit' command.
 123
 124Edit the commit message before committing to SVN.  This is off by
 125default for objects that are commits, and forced on when committing
 126tree objects.
 127
 128repo-config key: svn.edit
 129
 130-l<num>::
 131--find-copies-harder::
 132
 133Both of these are only used with the 'commit' command.
 134
 135They are both passed directly to git-diff-tree see
 136gitlink:git-diff-tree[1] for more information.
 137
 138[verse]
 139repo-config key: svn.l
 140repo-config key: svn.findcopiesharder
 141
 142-A<filename>::
 143--authors-file=<filename>::
 144
 145Syntax is compatible with the files used by git-svnimport and
 146git-cvsimport:
 147
 148------------------------------------------------------------------------
 149        loginname = Joe User <user@example.com>
 150------------------------------------------------------------------------
 151
 152If this option is specified and git-svn encounters an SVN
 153committer name that does not exist in the authors-file, git-svn
 154will abort operation. The user will then have to add the
 155appropriate entry.  Re-running the previous git-svn command
 156after the authors-file is modified should continue operation.
 157
 158repo-config key: svn.authors-file
 159
 160--
 161
 162ADVANCED OPTIONS
 163----------------
 164--
 165
 166-b<refname>::
 167--branch <refname>::
 168Used with 'fetch' or 'commit'.
 169
 170This can be used to join arbitrary git branches to remotes/git-svn
 171on new commits where the tree object is equivalent.
 172
 173When used with different GIT_SVN_ID values, tags and branches in
 174SVN can be tracked this way, as can some merges where the heads
 175end up having completely equivalent content.  This can even be
 176used to track branches across multiple SVN _repositories_.
 177
 178This option may be specified multiple times, once for each
 179branch.
 180
 181repo-config key: svn.branch
 182
 183-i<GIT_SVN_ID>::
 184--id <GIT_SVN_ID>::
 185
 186This sets GIT_SVN_ID (instead of using the environment).  See the
 187section on
 188'<<tracking-multiple-repos,Tracking Multiple Repositories or Branches>>'
 189for more information on using GIT_SVN_ID.
 190
 191--
 192
 193COMPATIBILITY OPTIONS
 194---------------------
 195--
 196
 197--upgrade::
 198Only used with the 'rebuild' command.
 199
 200Run this if you used an old version of git-svn that used
 201"git-svn-HEAD" instead of "remotes/git-svn" as the branch
 202for tracking the remote.
 203
 204--no-ignore-externals::
 205Only used with the 'fetch' and 'rebuild' command.
 206
 207By default, git-svn passes --ignore-externals to svn to avoid
 208fetching svn:external trees into git.  Pass this flag to enable
 209externals tracking directly via git.
 210
 211Versions of svn that do not support --ignore-externals are
 212automatically detected and this flag will be automatically
 213enabled for them.
 214
 215Otherwise, do not enable this flag unless you know what you're
 216doing.
 217
 218repo-config key: svn.noignoreexternals
 219
 220--
 221
 222Basic Examples
 223~~~~~~~~~~~~~~
 224
 225Tracking and contributing to an Subversion managed-project:
 226
 227------------------------------------------------------------------------
 228# Initialize a tree (like git init-db):
 229        git-svn init http://svn.foo.org/project/trunk
 230# Fetch remote revisions:
 231        git-svn fetch
 232# Create your own branch to hack on:
 233        git checkout -b my-branch remotes/git-svn
 234# Commit only the git commits you want to SVN:
 235        git-svn commit <tree-ish> [<tree-ish_2> ...]
 236# Commit all the git commits from my-branch that don't exist in SVN:
 237        git-svn commit remotes/git-svn..my-branch
 238# Something is committed to SVN, pull the latest into your branch:
 239        git-svn fetch && git pull . remotes/git-svn
 240# Append svn:ignore settings to the default git exclude file:
 241        git-svn show-ignore >> .git/info/exclude
 242------------------------------------------------------------------------
 243
 244DESIGN PHILOSOPHY
 245-----------------
 246Merge tracking in Subversion is lacking and doing branched development
 247with Subversion is cumbersome as a result.  git-svn completely forgoes
 248any automated merge/branch tracking on the Subversion side and leaves it
 249entirely up to the user on the git side.  It's simply not worth it to do
 250a useful translation when the original signal is weak.
 251
 252[[tracking-multiple-repos]]
 253TRACKING MULTIPLE REPOSITORIES OR BRANCHES
 254------------------------------------------
 255This is for advanced users, most users should ignore this section.
 256
 257Because git-svn does not care about relationships between different
 258branches or directories in a Subversion repository, git-svn has a simple
 259hack to allow it to track an arbitrary number of related _or_ unrelated
 260SVN repositories via one git repository.  Simply set the GIT_SVN_ID
 261environment variable to a name other other than "git-svn" (the default)
 262and git-svn will ignore the contents of the $GIT_DIR/git-svn directory
 263and instead do all of its work in $GIT_DIR/$GIT_SVN_ID for that
 264invocation.  The interface branch will be remotes/$GIT_SVN_ID, instead of
 265remotes/git-svn.  Any remotes/$GIT_SVN_ID branch should never be modified
 266by the user outside of git-svn commands.
 267
 268[[fetch-args]]
 269ADDITIONAL FETCH ARGUMENTS
 270--------------------------
 271This is for advanced users, most users should ignore this section.
 272
 273Unfetched SVN revisions may be imported as children of existing commits
 274by specifying additional arguments to 'fetch'.  Additional parents may
 275optionally be specified in the form of sha1 hex sums at the
 276command-line.  Unfetched SVN revisions may also be tied to particular
 277git commits with the following syntax:
 278
 279------------------------------------------------
 280        svn_revision_number=git_commit_sha1
 281------------------------------------------------
 282
 283This allows you to tie unfetched SVN revision 375 to your current HEAD:
 284
 285------------------------------------------------
 286        git-svn fetch 375=$(git-rev-parse HEAD)
 287------------------------------------------------
 288
 289Advanced Example: Tracking a Reorganized Repository
 290~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 291If you're tracking a directory that has moved, or otherwise been
 292branched or tagged off of another directory in the repository and you
 293care about the full history of the project, then you can read this
 294section.
 295
 296This is how Yann Dirson tracked the trunk of the ufoai directory when
 297the /trunk directory of his repository was moved to /ufoai/trunk and
 298he needed to continue tracking /ufoai/trunk where /trunk left off.
 299
 300------------------------------------------------------------------------
 301        # This log message shows when the repository was reorganized:
 302        r166 | ydirson | 2006-03-02 01:36:55 +0100 (Thu, 02 Mar 2006) | 1 line
 303        Changed paths:
 304           D /trunk
 305           A /ufoai/trunk (from /trunk:165)
 306
 307        # First we start tracking the old revisions:
 308        GIT_SVN_ID=git-oldsvn git-svn init \
 309                        https://svn.sourceforge.net/svnroot/ufoai/trunk
 310        GIT_SVN_ID=git-oldsvn git-svn fetch -r1:165
 311
 312        # And now, we continue tracking the new revisions:
 313        GIT_SVN_ID=git-newsvn git-svn init \
 314              https://svn.sourceforge.net/svnroot/ufoai/ufoai/trunk
 315        GIT_SVN_ID=git-newsvn git-svn fetch \
 316              166=`git-rev-parse refs/remotes/git-oldsvn`
 317------------------------------------------------------------------------
 318
 319BUGS
 320----
 321If somebody commits a conflicting changeset to SVN at a bad moment
 322(right before you commit) causing a conflict and your commit to fail,
 323your svn working tree ($GIT_DIR/git-svn/tree) may be dirtied.  The
 324easiest thing to do is probably just to rm -rf $GIT_DIR/git-svn/tree and
 325run 'rebuild'.
 326
 327We ignore all SVN properties except svn:executable.  Too difficult to
 328map them since we rely heavily on git write-tree being _exactly_ the
 329same on both the SVN and git working trees and I prefer not to clutter
 330working trees with metadata files.
 331
 332svn:keywords can't be ignored in Subversion (at least I don't know of
 333a way to ignore them).
 334
 335Renamed and copied directories are not detected by git and hence not
 336tracked when committing to SVN.  I do not plan on adding support for
 337this as it's quite difficult and time-consuming to get working for all
 338the possible corner cases (git doesn't do it, either).  Renamed and
 339copied files are fully supported if they're similar enough for git to
 340detect them.
 341
 342Author
 343------
 344Written by Eric Wong <normalperson@yhbt.net>.
 345
 346Documentation
 347-------------
 348Written by Eric Wong <normalperson@yhbt.net>.