6 git-svn - bidirectional operation between a single Subversion branch and git
10 'git-svn' <command> [options] [arguments]
14 git-svn is a simple conduit for changesets between a single Subversion
17 git-svn is not to be confused with git-svnimport. The were designed
18 with very different goals in mind.
20 git-svn is designed for an individual developer who wants a
21 bidirectional flow of changesets between a single branch in Subversion
22 and an arbitrary number of branches in git. git-svnimport is designed
23 for read-only operation on repositories that match a particular layout
24 (albeit the recommended one by SVN developers).
26 For importing svn, git-svnimport is potentially more powerful when
27 operating on repositories organized under the recommended
28 trunk/branch/tags structure, and should be faster, too.
30 git-svn completely ignores the very limited view of branching that
31 Subversion has. This allows git-svn to be much easier to use,
32 especially on repositories that are not organized in a manner that
33 git-svnimport is designed for.
38 Creates an empty git repository with additional metadata
39 directories for git-svn. The SVN_URL must be specified
43 Fetch unfetched revisions from the SVN_URL we are tracking.
44 refs/heads/git-svn-HEAD will be updated to the latest revision.
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.
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
65 Recursively finds and lists the svn:ignore property on
66 directories. The output is suitable for appending to
67 the $GIT_DIR/info/exclude file.
73 Only used with the 'fetch' command.
75 Takes any valid -r<argument> svn would accept and passes it
76 directly to svn. -r<ARG1>:<ARG2> ranges and "{" DATE "}" syntax
77 is also supported. This is passed directly to svn, see svn
78 documentation for more details.
80 This can allow you to make partial mirrors when running fetch.
84 Only used with the 'commit' command.
86 Read a list of commits from stdin and commit them in reverse
87 order. Only the leading sha1 is read from each line, so
88 git-rev-list --pretty=oneline output can be used.
91 Only used with the 'commit' command.
93 Remove directories from the SVN tree if there are no files left
94 behind. SVN can version empty directories, and they are not
95 removed by default if there are no files left in them. git
96 cannot version empty directories. Enabling this flag will make
97 the commit to SVN act like git.
101 Only used with the 'commit' command.
103 Edit the commit message before committing to SVN. This is off by
104 default for objects that are commits, and forced on when committing
108 --find-copies-harder::
109 Both of these are only used with the 'commit' command.
111 They are both passed directly to git-diff-tree see
112 git-diff-tree(1) for more information.
114 COMPATIBILITY OPTIONS
115 ---------------------
116 --no-ignore-externals::
117 Only used with the 'fetch' and 'rebuild' command.
119 By default, git-svn passes --ignore-externals to svn to avoid
120 fetching svn:external trees into git. Pass this flag to enable
121 externals tracking directly via git.
123 Versions of svn that do not support --ignore-externals are
124 automatically detected and this flag will be automatically
127 Otherwise, do not enable this flag unless you know what you're
131 Only used with the 'fetch' command.
133 By default, git-svn passes --stop-on-copy to avoid dealing with
134 the copied/renamed branch directory problem entirely. A
135 copied/renamed branch is the result of a <SVN_URL> being created
136 in the past from a different source. These are problematic to
137 deal with even when working purely with svn if you work inside
140 Do not use this flag unless you know exactly what you're getting
141 yourself into. You have been warned.
146 Tracking and contributing to an Subversion managed-project:
148 # Initialize a tree (like git init-db)::
149 git-svn init http://svn.foo.org/project/trunk
150 # Fetch remote revisions::
152 # Create your own branch to hack on::
153 git checkout -b my-branch git-svn-HEAD
154 # Commit only the git commits you want to SVN::
155 git-svn commit <tree-ish> [<tree-ish_2> ...]
156 # Commit all the git commits from my-branch that don't exist in SVN::
157 git commit git-svn-HEAD..my-branch
158 # Something is committed to SVN, pull the latest into your branch::
159 git-svn fetch && git pull . git-svn-HEAD
160 # Append svn:ignore settings to the default git exclude file:
161 git-svn show-ignore >> .git/info/exclude
165 Merge tracking in Subversion is lacking and doing branched development
166 with Subversion is cumbersome as a result. git-svn completely forgoes
167 any automated merge/branch tracking on the Subversion side and leaves it
168 entirely up to the user on the git side. It's simply not worth it to do
169 a useful translation when the the original signal is weak.
171 TRACKING MULTIPLE REPOSITORIES OR BRANCHES
172 ------------------------------------------
173 This is for advanced users, most users should ignore this section.
175 Because git-svn does not care about relationships between different
176 branches or directories in a Subversion repository, git-svn has a simple
177 hack to allow it to track an arbitrary number of related _or_ unrelated
178 SVN repositories via one git repository. Simply set the GIT_SVN_ID
179 environment variable to a name other other than "git-svn" (the default)
180 and git-svn will ignore the contents of the $GIT_DIR/git-svn directory
181 and instead do all of its work in $GIT_DIR/$GIT_SVN_ID for that
184 ADDITIONAL FETCH ARGUMENTS
185 --------------------------
186 This is for advanced users, most users should ignore this section.
188 Unfetched SVN revisions may be imported as children of existing commits
189 by specifying additional arguments to 'fetch'. Additional parents may
190 optionally be specified in the form of sha1 hex sums at the
191 command-line. Unfetched SVN revisions may also be tied to particular
192 git commits with the following syntax:
194 svn_revision_number=git_commit_sha1
196 This allows you to tie unfetched SVN revision 375 to your current HEAD::
198 git-svn fetch 375=$(git-rev-parse HEAD)
202 If somebody commits a conflicting changeset to SVN at a bad moment
203 (right before you commit) causing a conflict and your commit to fail,
204 your svn working tree ($GIT_DIR/git-svn/tree) may be dirtied. The
205 easiest thing to do is probably just to rm -rf $GIT_DIR/git-svn/tree and
208 We ignore all SVN properties except svn:executable. Too difficult to
209 map them since we rely heavily on git write-tree being _exactly_ the
210 same on both the SVN and git working trees and I prefer not to clutter
211 working trees with metadata files.
213 svn:keywords can't be ignored in Subversion (at least I don't know of
214 a way to ignore them).
216 Renamed and copied directories are not detected by git and hence not
217 tracked when committing to SVN. I do not plan on adding support for
218 this as it's quite difficult and time-consuming to get working for all
219 the possible corner cases (git doesn't do it, either). Renamed and
220 copied files are fully supported if they're similar enough for git to
225 Written by Eric Wong <normalperson@yhbt.net>.
229 Written by Eric Wong <normalperson@yhbt.net>.