contrib / git-svn / git-svn.txton commit Merge part of pack-thin branch (207a1f3)
   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.
  16
  17git-svn is not to be confused with git-svnimport.  The were designed
  18with very different goals in mind.
  19
  20git-svn is designed for an individual developer who wants a
  21bidirectional flow of changesets between a single branch in Subversion
  22and an arbitrary number of branches in git.  git-svnimport is designed
  23for read-only operation on repositories that match a particular layout
  24(albeit the recommended one by SVN developers).
  25
  26For importing svn, git-svnimport is potentially more powerful when
  27operating on repositories organized under the recommended
  28trunk/branch/tags structure, and should be faster, too.
  29
  30git-svn completely ignores the very limited view of branching that
  31Subversion has.  This allows git-svn to be much easier to use,
  32especially on repositories that are not organized in a manner that
  33git-svnimport is designed for.
  34
  35COMMANDS
  36--------
  37init::
  38        Creates an empty git repository with additional metadata
  39        directories for git-svn.  The SVN_URL must be specified
  40        at this point.
  41
  42fetch::
  43        Fetch unfetched revisions from the SVN_URL we are tracking.
  44        refs/heads/git-svn-HEAD will be updated to the latest revision.
  45
  46commit::
  47        Commit specified commit or tree objects to SVN.  This relies on
  48        your imported fetch data being up-to-date.  This makes
  49        absolutely no attempts to do patching when committing to SVN, it
  50        simply overwrites files with those specified in the tree or
  51        commit.  All merging is assumed to have taken place
  52        independently of git-svn functions.
  53
  54rebuild::
  55        Not a part of daily usage, but this is a useful command if
  56        you've just cloned a repository (using git-clone) that was
  57        tracked with git-svn.  Unfortunately, git-clone does not clone
  58        git-svn metadata and the svn working tree that git-svn uses for
  59        its operations.  This rebuilds the metadata so git-svn can
  60        resume fetch operations.  SVN_URL may be optionally specified if
  61        the directory/repository you're tracking has moved or changed
  62        protocols.
  63
  64OPTIONS
  65-------
  66-r <ARG>::
  67--revision <ARG>::
  68        Only used with the 'fetch' command.
  69
  70        Takes any valid -r<argument> svn would accept and passes it
  71        directly to svn. -r<ARG1>:<ARG2> ranges and "{" DATE "}" syntax
  72        is also supported.  This is passed directly to svn, see svn
  73        documentation for more details.
  74
  75        This can allow you to make partial mirrors when running fetch.
  76
  77-::
  78--stdin::
  79        Only used with the 'commit' command.
  80
  81        Read a list of commits from stdin and commit them in reverse
  82        order.  Only the leading sha1 is read from each line, so
  83        git-rev-list --pretty=oneline output can be used.
  84
  85--rmdir::
  86        Only used with the 'commit' command.
  87
  88        Remove directories from the SVN tree if there are no files left
  89        behind.  SVN can version empty directories, and they are not
  90        removed by default if there are no files left in them.  git
  91        cannot version empty directories.  Enabling this flag will make
  92        the commit to SVN act like git.
  93
  94-e::
  95--edit::
  96        Only used with the 'commit' command.
  97
  98        Edit the commit message before committing to SVN.  This is off by
  99        default for objects that are commits, and forced on when committing
 100        tree objects.
 101
 102-l<num>::
 103--find-copies-harder::
 104        Both of these are only used with the 'commit' command.
 105
 106        They are both passed directly to git-diff-tree see
 107        git-diff-tree(1) for more information.
 108
 109COMPATIBILITY OPTIONS
 110---------------------
 111--no-ignore-externals::
 112        Only used with the 'fetch' and 'rebuild' command.
 113
 114        By default, git-svn passes --ignore-externals to svn to avoid
 115        fetching svn:external trees into git.  Pass this flag to enable
 116        externals tracking directly via git.
 117
 118        Versions of svn that do not support --ignore-externals are
 119        automatically detected and this flag will be automatically
 120        enabled for them.
 121
 122        Otherwise, do not enable this flag unless you know what you're
 123        doing.
 124
 125--no-stop-on-copy::
 126        Only used with the 'fetch' command.
 127
 128        By default, git-svn passes --stop-on-copy to avoid dealing with
 129        the copied/renamed branch directory problem entirely.  A
 130        copied/renamed branch is the result of a <SVN_URL> being created
 131        in the past from a different source.  These are problematic to
 132        deal with even when working purely with svn if you work inside
 133        subdirectories.
 134
 135        Do not use this flag unless you know exactly what you're getting
 136        yourself into.  You have been warned.
 137
 138Examples
 139~~~~~~~~
 140
 141Tracking and contributing to an Subversion managed-project:
 142
 143# Initialize a tree (like git init-db)::
 144        git-svn init http://svn.foo.org/project/trunk
 145# Fetch remote revisions::
 146        git-svn fetch
 147# Create your own branch to hack on::
 148        git checkout -b my-branch git-svn-HEAD
 149# Commit only the git commits you want to SVN::
 150        git-svn commit <tree-ish> [<tree-ish_2> ...]
 151# Commit all the git commits from my-branch that don't exist in SVN::
 152        git commit git-svn-HEAD..my-branch
 153# Something is committed to SVN, pull the latest into your branch::
 154        git-svn fetch && git pull . git-svn-HEAD
 155
 156DESIGN PHILOSOPHY
 157-----------------
 158Merge tracking in Subversion is lacking and doing branched development
 159with Subversion is cumbersome as a result.  git-svn completely forgoes
 160any automated merge/branch tracking on the Subversion side and leaves it
 161entirely up to the user on the git side.  It's simply not worth it to do
 162a useful translation when the the original signal is weak.
 163
 164TRACKING MULTIPLE REPOSITORIES OR BRANCHES
 165------------------------------------------
 166This is for advanced users, most users should ignore this section.
 167
 168Because git-svn does not care about relationships between different
 169branches or directories in a Subversion repository, git-svn has a simple
 170hack to allow it to track an arbitrary number of related _or_ unrelated
 171SVN repositories via one git repository.  Simply set the GIT_SVN_ID
 172environment variable to a name other other than "git-svn" (the default)
 173and git-svn will ignore the contents of the $GIT_DIR/git-svn directory
 174and instead do all of its work in $GIT_DIR/$GIT_SVN_ID for that
 175invocation.
 176
 177ADDITIONAL FETCH ARGUMENTS
 178--------------------------
 179This is for advanced users, most users should ignore this section.
 180
 181Unfetched SVN revisions may be imported as children of existing commits
 182by specifying additional arguments to 'fetch'.  Additional parents may
 183optionally be specified in the form of sha1 hex sums at the
 184command-line.  Unfetched SVN revisions may also be tied to particular
 185git commits with the following syntax:
 186
 187        svn_revision_number=git_commit_sha1
 188
 189This allows you to tie unfetched SVN revision 375 to your current HEAD::
 190
 191        git-svn fetch 375=$(git-rev-parse HEAD)
 192
 193BUGS
 194----
 195If somebody commits a conflicting changeset to SVN at a bad moment
 196(right before you commit) causing a conflict and your commit to fail,
 197your svn working tree ($GIT_DIR/git-svn/tree) may be dirtied.  The
 198easiest thing to do is probably just to rm -rf $GIT_DIR/git-svn/tree and
 199run 'rebuild'.
 200
 201We ignore all SVN properties except svn:executable.  Too difficult to
 202map them since we rely heavily on git write-tree being _exactly_ the
 203same on both the SVN and git working trees and I prefer not to clutter
 204working trees with metadata files.
 205
 206svn:keywords can't be ignored in Subversion (at least I don't know of
 207a way to ignore them).
 208
 209Renamed and copied directories are not detected by git and hence not
 210tracked when committing to SVN.  I do not plan on adding support for
 211this as it's quite difficult and time-consuming to get working for all
 212the possible corner cases (git doesn't do it, either).  Renamed and
 213copied files are fully supported if they're similar enough for git to
 214detect them.
 215
 216Author
 217------
 218Written by Eric Wong <normalperson@yhbt.net>.
 219
 220Documentation
 221-------------
 222Written by Eric Wong <normalperson@yhbt.net>.