{
    "mode": "man",
    "parameter": "git-svn",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/git-svn/1/json",
    "generated": "2026-07-05T13:13:40Z",
    "synopsis": "git svn <command> [<options>] [<arguments>]",
    "sections": {
        "NAME": {
            "content": "git-svn - Bidirectional operation between a Subversion repository and Git\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "git svn <command> [<options>] [<arguments>]\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "git svn is a simple conduit for changesets between Subversion and Git. It provides a\nbidirectional flow of changes between a Subversion and a Git repository.\n\ngit svn can track a standard Subversion repository, following the common\n\"trunk/branches/tags\" layout, with the --stdlayout option. It can also follow branches and\ntags in any layout with the -T/-t/-b options (see options to init below, and also the clone\ncommand).\n\nOnce tracking a Subversion repository (with any of the above methods), the Git repository can\nbe updated from Subversion by the fetch command and Subversion updated from Git by the\ndcommit command.\n",
            "subsections": []
        },
        "COMMANDS": {
            "content": "init\nInitializes an empty Git repository with additional metadata directories for git svn. The\nSubversion URL may be specified as a command-line argument, or as full URL arguments to\n-T/-t/-b. Optionally, the target directory to operate on can be specified as a second\nargument. Normally this command initializes the current directory.\n\n-T<trunksubdir>, --trunk=<trunksubdir>, -t<tagssubdir>, --tags=<tagssubdir>,\n-b<branchessubdir>, --branches=<branchessubdir>, -s, --stdlayout\nThese are optional command-line options for init. Each of these flags can point to a\nrelative repository path (--tags=project/tags) or a full url\n(--tags=https://foo.org/project/tags). You can specify more than one --tags and/or\n--branches options, in case your Subversion repository places tags or branches under\nmultiple paths. The option --stdlayout is a shorthand way of setting\ntrunk,tags,branches as the relative paths, which is the Subversion default. If any of\nthe other options are given as well, they take precedence.\n\n--no-metadata\nSet the noMetadata option in the [svn-remote] config. This option is not recommended,\nplease read the svn.noMetadata section of this manpage before using this option.\n\n--use-svm-props\nSet the useSvmProps option in the [svn-remote] config.\n\n--use-svnsync-props\nSet the useSvnsyncProps option in the [svn-remote] config.\n\n--rewrite-root=<URL>\nSet the rewriteRoot option in the [svn-remote] config.\n\n--rewrite-uuid=<UUID>\nSet the rewriteUUID option in the [svn-remote] config.\n\n--username=<user>\nFor transports that SVN handles authentication for (http, https, and plain svn),\nspecify the username. For other transports (e.g.  svn+ssh://), you must include the\nusername in the URL, e.g.  svn+ssh://foo@svn.bar.com/project\n\n--prefix=<prefix>\nThis allows one to specify a prefix which is prepended to the names of remotes if\ntrunk/branches/tags are specified. The prefix does not automatically include a\ntrailing slash, so be sure you include one in the argument if that is what you want.\nIf --branches/-b is specified, the prefix must include a trailing slash. Setting a\nprefix (with a trailing slash) is strongly encouraged in any case, as your\nSVN-tracking refs will then be located at \"refs/remotes/$prefix/\", which is\ncompatible with Git’’s own remote-tracking ref layout (refs/remotes/$remote/). Setting\na prefix is also useful if you wish to track multiple projects that share a common\nrepository. By default, the prefix is set to origin/.\n\nNote\nBefore Git v2.0, the default prefix was \"\" (no prefix). This meant that\nSVN-tracking refs were put at \"refs/remotes/*\", which is incompatible with how\nGit’s own remote-tracking refs are organized. If you still want the old default,\nyou can get it by passing --prefix \"\" on the command line (--prefix=\"\" may not\nwork if your Perl’s Getopt::Long is < v2.37).\n\n--ignore-refs=<regex>\nWhen passed to init or clone this regular expression will be preserved as a config\nkey. See fetch for a description of --ignore-refs.\n\n--ignore-paths=<regex>\nWhen passed to init or clone this regular expression will be preserved as a config\nkey. See fetch for a description of --ignore-paths.\n\n--include-paths=<regex>\nWhen passed to init or clone this regular expression will be preserved as a config\nkey. See fetch for a description of --include-paths.\n\n--no-minimize-url\nWhen tracking multiple directories (using --stdlayout, --branches, or --tags\noptions), git svn will attempt to connect to the root (or highest allowed level) of\nthe Subversion repository. This default allows better tracking of history if entire\nprojects are moved within a repository, but may cause issues on repositories where\nread access restrictions are in place. Passing --no-minimize-url will allow git svn\nto accept URLs as-is without attempting to connect to a higher level directory. This\noption is off by default when only one URL/branch is tracked (it would do little\ngood).\n\nfetch\nFetch unfetched revisions from the Subversion remote we are tracking. The name of the\n[svn-remote \"...\"] section in the $GITDIR/config file may be specified as an optional\ncommand-line argument.\n\nThis automatically updates the revmap if needed (see $GITDIR/svn//.revmap.*  in the\nFILES section below for details).\n\n--localtime\nStore Git commit times in the local time zone instead of UTC. This makes git log\n(even without --date=local) show the same times that svn log would in the local time\nzone.\n\nThis doesn’t interfere with interoperating with the Subversion repository you cloned\nfrom, but if you wish for your local Git repository to be able to interoperate with\nsomeone else’s local Git repository, either don’t use this option or you should both\nuse it in the same local time zone.\n\n--parent\nFetch only from the SVN parent of the current HEAD.\n\n--ignore-refs=<regex>\nIgnore refs for branches or tags matching the Perl regular expression. A \"negative\nlook-ahead assertion\" like ^refs/remotes/origin/(?!tags/wanted-tag|wanted-branch).*$\ncan be used to allow only certain refs.\n\nconfig key: svn-remote.<name>.ignore-refs\n\nIf the ignore-refs configuration key is set, and the command-line option is also\ngiven, both regular expressions will be used.\n\n--ignore-paths=<regex>\nThis allows one to specify a Perl regular expression that will cause skipping of all\nmatching paths from checkout from SVN. The --ignore-paths option should match for\nevery fetch (including automatic fetches due to clone, dcommit, rebase, etc) on a\ngiven repository.\n\nconfig key: svn-remote.<name>.ignore-paths\n\nIf the ignore-paths configuration key is set, and the command-line option is also\ngiven, both regular expressions will be used.\n\nExamples:\n\nSkip \"doc*\" directory for every fetch\n\n--ignore-paths=\"^doc\"\n\n\nSkip \"branches\" and \"tags\" of first level directories\n\n--ignore-paths=\"^[^/]+/(?:branches|tags)\"\n\n\n--include-paths=<regex>\nThis allows one to specify a Perl regular expression that will cause the inclusion of\nonly matching paths from checkout from SVN. The --include-paths option should match\nfor every fetch (including automatic fetches due to clone, dcommit, rebase, etc) on a\ngiven repository.  --ignore-paths takes precedence over --include-paths.\n\nconfig key: svn-remote.<name>.include-paths\n\n\n--log-window-size=<n>\nFetch <n> log entries per request when scanning Subversion history. The default is\n100. For very large Subversion repositories, larger values may be needed for\nclone/fetch to complete in reasonable time. But overly large values may lead to\nhigher memory usage and request timeouts.\n\nclone\nRuns init and fetch. It will automatically create a directory based on the basename of\nthe URL passed to it; or if a second argument is passed; it will create a directory and\nwork within that. It accepts all arguments that the init and fetch commands accept; with\nthe exception of --fetch-all and --parent. After a repository is cloned, the fetch\ncommand will be able to update revisions without affecting the working tree; and the\nrebase command will be able to update the working tree with the latest changes.\n\n--preserve-empty-dirs\nCreate a placeholder file in the local Git repository for each empty directory\nfetched from Subversion. This includes directories that become empty by removing all\nentries in the Subversion repository (but not the directory itself). The placeholder\nfiles are also tracked and removed when no longer necessary.\n\n--placeholder-filename=<filename>\nSet the name of placeholder files created by --preserve-empty-dirs. Default:\n\".gitignore\"\n\nrebase\nThis fetches revisions from the SVN parent of the current HEAD and rebases the current\n(uncommitted to SVN) work against it.\n\nThis works similarly to svn update or git pull except that it preserves linear history\nwith git rebase instead of git merge for ease of dcommitting with git svn.\n\nThis accepts all options that git svn fetch and git rebase accept. However, --fetch-all\nonly fetches from the current [svn-remote], and not all [svn-remote] definitions.\n\nLike git rebase; this requires that the working tree be clean and have no uncommitted\nchanges.\n\nThis automatically updates the revmap if needed (see $GITDIR/svn//.revmap.*  in the\nFILES section below for details).\n\n-l, --local\nDo not fetch remotely; only run git rebase against the last fetched commit from the\nupstream SVN.\n\ndcommit\nCommit each diff from the current branch directly to the SVN repository, and then rebase\nor reset (depending on whether or not there is a diff between SVN and head). This will\ncreate a revision in SVN for each commit in Git.\n\nWhen an optional Git branch name (or a Git commit object name) is specified as an\nargument, the subcommand works on the specified branch, not on the current branch.\n\nUse of dcommit is preferred to set-tree (below).\n\n--no-rebase\nAfter committing, do not rebase or reset.\n\n--commit-url <URL>\nCommit to this SVN URL (the full path). This is intended to allow existing git svn\nrepositories created with one transport method (e.g.  svn:// or http:// for anonymous\nread) to be reused if a user is later given access to an alternate transport method\n(e.g.  svn+ssh:// or https://) for commit.\n\nconfig key: svn-remote.<name>.commiturl\nconfig key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)\n\nNote that the SVN URL of the commiturl config key includes the SVN branch. If you\nrather want to set the commit URL for an entire SVN repository use\nsvn-remote.<name>.pushurl instead.\n\nUsing this option for any other purpose (don’t ask) is very strongly discouraged.\n\n--mergeinfo=<mergeinfo>\nAdd the given merge information during the dcommit (e.g.\n--mergeinfo=\"/branches/foo:1-10\"). All svn server versions can store this information\n(as a property), and svn clients starting from version 1.5 can make use of it. To\nspecify merge information from multiple branches, use a single space character\nbetween the branches (--mergeinfo=\"/branches/foo:1-10 /branches/bar:3,5-6,8\")\n\nconfig key: svn.pushmergeinfo\n\nThis option will cause git-svn to attempt to automatically populate the svn:mergeinfo\nproperty in the SVN repository when possible. Currently, this can only be done when\ndcommitting non-fast-forward merges where all parents but the first have already been\npushed into SVN.\n\n--interactive\nAsk the user to confirm that a patch set should actually be sent to SVN. For each\npatch, one may answer \"yes\" (accept this patch), \"no\" (discard this patch), \"all\"\n(accept all patches), or \"quit\".\n\ngit svn dcommit returns immediately if answer is \"no\" or \"quit\", without committing\nanything to SVN.\n\nbranch\nCreate a branch in the SVN repository.\n\n-m, --message\nAllows to specify the commit message.\n\n-t, --tag\nCreate a tag by using the tagssubdir instead of the branchessubdir specified during\ngit svn init.\n\n-d<path>, --destination=<path>\nIf more than one --branches (or --tags) option was given to the init or clone\ncommand, you must provide the location of the branch (or tag) you wish to create in\nthe SVN repository. <path> specifies which path to use to create the branch or tag\nand should match the pattern on the left-hand side of one of the configured branches\nor tags refspecs. You can see these refspecs with the commands\n\ngit config --get-all svn-remote.<name>.branches\ngit config --get-all svn-remote.<name>.tags\n\nwhere <name> is the name of the SVN repository as specified by the -R option to init\n(or \"svn\" by default).\n\n--username\nSpecify the SVN username to perform the commit as. This option overrides the username\nconfiguration property.\n\n--commit-url\nUse the specified URL to connect to the destination Subversion repository. This is\nuseful in cases where the source SVN repository is read-only. This option overrides\nconfiguration property commiturl.\n\ngit config --get-all svn-remote.<name>.commiturl\n\n--parents\nCreate parent folders. This parameter is equivalent to the parameter --parents on svn\ncp commands and is useful for non-standard repository layouts.\n\ntag\nCreate a tag in the SVN repository. This is a shorthand for branch -t.\n\nlog\nThis should make it easy to look up svn log messages when svn users refer to\n-r/--revision numbers.\n\nThe following features from ‘svn log’ are supported:\n\n-r <n>[:<n>], --revision=<n>[:<n>]\nis supported, non-numeric args are not: HEAD, NEXT, BASE, PREV, etc ...\n\n-v, --verbose\nit’s not completely compatible with the --verbose output in svn log, but reasonably\nclose.\n\n--limit=<n>\nis NOT the same as --max-count, doesn’t count merged/excluded commits\n\n--incremental\nsupported\n\nNew features:\n\n--show-commit\nshows the Git commit sha1, as well\n\n--oneline\nour version of --pretty=oneline\n\n\nNote\nSVN itself only stores times in UTC and nothing else. The regular svn client converts\nthe UTC time to the local time (or based on the TZ= environment). This command has\nthe same behaviour.\nAny other arguments are passed directly to git log\n\nblame\nShow what revision and author last modified each line of a file. The output of this mode\nis format-compatible with the output of ‘svn blame’ by default. Like the SVN blame\ncommand, local uncommitted changes in the working tree are ignored; the version of the\nfile in the HEAD revision is annotated. Unknown arguments are passed directly to git\nblame.\n\n--git-format\nProduce output in the same format as git blame, but with SVN revision numbers instead\nof Git commit hashes. In this mode, changes that haven’t been committed to SVN\n(including local working-copy edits) are shown as revision 0.\n\nfind-rev\nWhen given an SVN revision number of the form rN, returns the corresponding Git commit\nhash (this can optionally be followed by a tree-ish to specify which branch should be\nsearched). When given a tree-ish, returns the corresponding SVN revision number.\n\n-B, --before\nDon’t require an exact match if given an SVN revision, instead find the commit\ncorresponding to the state of the SVN repository (on the current branch) at the\nspecified revision.\n\n-A, --after\nDon’t require an exact match if given an SVN revision; if there is not an exact match\nreturn the closest match searching forward in the history.\n\nset-tree\nYou should consider using dcommit instead of this command. Commit specified commit or\ntree objects to SVN. This relies on your imported fetch data being up to date. This makes\nabsolutely no attempts to do patching when committing to SVN, it simply overwrites files\nwith those specified in the tree or commit. All merging is assumed to have taken place\nindependently of git svn functions.\n\ncreate-ignore\nRecursively finds the svn:ignore property on directories and creates matching .gitignore\nfiles. The resulting files are staged to be committed, but are not committed. Use\n-r/--revision to refer to a specific revision.\n\nshow-ignore\nRecursively finds and lists the svn:ignore property on directories. The output is\nsuitable for appending to the $GITDIR/info/exclude file.\n\nmkdirs\nAttempts to recreate empty directories that core Git cannot track based on information in\n$GITDIR/svn/<refname>/unhandled.log files. Empty directories are automatically recreated\nwhen using \"git svn clone\" and \"git svn rebase\", so \"mkdirs\" is intended for use after\ncommands like \"git checkout\" or \"git reset\". (See the svn-remote.<name>.automkdirs config\nfile option for more information.)\n\ncommit-diff\nCommits the diff of two tree-ish arguments from the command-line. This command does not\nrely on being inside a git svn init-ed repository. This command takes three arguments,\n(a) the original tree to diff against, (b) the new tree result, (c) the URL of the target\nSubversion repository. The final argument (URL) may be omitted if you are working from a\ngit svn-aware repository (that has been init-ed with git svn). The -r<revision> option is\nrequired for this.\n\nThe commit message is supplied either directly with the -m or -F option, or indirectly\nfrom the tag or commit when the second tree-ish denotes such an object, or it is\nrequested by invoking an editor (see --edit option below).\n\n-m <msg>, --message=<msg>\nUse the given msg as the commit message. This option disables the --edit option.\n\n-F <filename>, --file=<filename>\nTake the commit message from the given file. This option disables the --edit option.\n\ninfo\nShows information about a file or directory similar to what ‘svn info’ provides. Does not\ncurrently support a -r/--revision argument. Use the --url option to output only the value\nof the URL: field.\n\nproplist\nLists the properties stored in the Subversion repository about a given file or directory.\nUse -r/--revision to refer to a specific Subversion revision.\n\npropget\nGets the Subversion property given as the first argument, for a file. A specific revision\ncan be specified with -r/--revision.\n\npropset\nSets the Subversion property given as the first argument, to the value given as the\nsecond argument for the file given as the third argument.\n\nExample:\n\ngit svn propset svn:keywords \"FreeBSD=%H\" devel/py-tipper/Makefile\n\nThis will set the property svn:keywords to FreeBSD=%H for the file\ndevel/py-tipper/Makefile.\n\nshow-externals\nShows the Subversion externals. Use -r/--revision to specify a specific revision.\n\ngc\nCompress $GITDIR/svn/<refname>/unhandled.log files and remove\n$GITDIR/svn/<refname>/index files.\n\nreset\nUndoes the effects of fetch back to the specified revision. This allows you to re-fetch\nan SVN revision. Normally the contents of an SVN revision should never change and reset\nshould not be necessary. However, if SVN permissions change, or if you alter your\n--ignore-paths option, a fetch may fail with \"not found in commit\" (file not previously\nvisible) or \"checksum mismatch\" (missed a modification). If the problem file cannot be\nignored forever (with --ignore-paths) the only way to repair the repo is to use reset.\n\nOnly the revmap and refs/remotes/git-svn are changed (see $GITDIR/svn//.revmap.*  in\nthe FILES section below for details). Follow reset with a fetch and then git reset or git\nrebase to move local branches onto the new tree.\n\n-r <n>, --revision=<n>\nSpecify the most recent revision to keep. All later revisions are discarded.\n\n-p, --parent\nDiscard the specified revision as well, keeping the nearest parent instead.\n\nExample:\nAssume you have local changes in \"master\", but you need to refetch \"r2\".\n\nr1---r2---r3 remotes/git-svn\n\\\nA---B master\n\nFix the ignore-paths or SVN permissions problem that caused \"r2\" to be incomplete in\nthe first place. Then:\n\ngit svn reset -r2 -p\ngit svn fetch\n\n\n\nr1---r2'--r3' remotes/git-svn\n\\\nr2---r3---A---B master\n\nThen fixup \"master\" with git rebase. Do NOT use git merge or your history will not be\ncompatible with a future dcommit!\n\ngit rebase --onto remotes/git-svn A^ master\n\n\n\nr1---r2'--r3' remotes/git-svn\n\\\nA'--B' master\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "--shared[=(false|true|umask|group|all|world|everybody)], --template=<templatedirectory>\nOnly used with the init command. These are passed directly to git init.\n",
            "subsections": [
                {
                    "name": "-r <arg>, --revision <arg>",
                    "content": "Used with the fetch command.\n\nThis allows revision ranges for partial/cauterized history to be supported. $NUMBER,\n$NUMBER1:$NUMBER2 (numeric ranges), $NUMBER:HEAD, and BASE:$NUMBER are all supported.\n\nThis can allow you to make partial mirrors when running fetch; but is generally not\nrecommended because history will be skipped and lost.\n\n-, --stdin\nOnly used with the set-tree command.\n\nRead a list of commits from stdin and commit them in reverse order. Only the leading sha1\nis read from each line, so git rev-list --pretty=oneline output can be used.\n",
                    "flag": "-r",
                    "long": "--revision",
                    "arg": "<arg>"
                },
                {
                    "name": "--rmdir",
                    "content": "Only used with the dcommit, set-tree and commit-diff commands.\n\nRemove directories from the SVN tree if there are no files left behind. SVN can version\nempty directories, and they are not removed by default if there are no files left in\nthem. Git cannot version empty directories. Enabling this flag will make the commit to\nSVN act like Git.\n\nconfig key: svn.rmdir\n\n",
                    "long": "--rmdir"
                },
                {
                    "name": "-e, --edit",
                    "content": "Only used with the dcommit, set-tree and commit-diff commands.\n\nEdit the commit message before committing to SVN. This is off by default for objects that\nare commits, and forced on when committing tree objects.\n\nconfig key: svn.edit\n\n",
                    "flag": "-e",
                    "long": "--edit"
                },
                {
                    "name": "-l<num>, --find-copies-harder",
                    "content": "Only used with the dcommit, set-tree and commit-diff commands.\n\nThey are both passed directly to git diff-tree; see git-diff-tree(1) for more\ninformation.\n\nconfig key: svn.l\nconfig key: svn.findcopiesharder\n\n\n-A<filename>, --authors-file=<filename>\nSyntax is compatible with the file used by git cvsimport but an empty email address can\nbe supplied with <>:\n\nloginname = Joe User <user@example.com>\n\nIf this option is specified and git svn encounters an SVN committer name that does not\nexist in the authors-file, git svn will abort operation. The user will then have to add\nthe appropriate entry. Re-running the previous git svn command after the authors-file is\nmodified should continue operation.\n\nconfig key: svn.authorsfile\n\n\n--authors-prog=<filename>\nIf this option is specified, for each SVN committer name that does not exist in the\nauthors file, the given file is executed with the committer name as the first argument.\nThe program is expected to return a single line of the form \"Name <email>\" or \"Name <>\",\nwhich will be treated as if included in the authors file.\n\nDue to historical reasons a relative filename is first searched relative to the current\ndirectory for init and clone and relative to the root of the working tree for fetch. If\nfilename is not found, it is searched like any other command in $PATH.\n\nconfig key: svn.authorsProg\n\n",
                    "long": "--find-copies-harder"
                },
                {
                    "name": "-q, --quiet",
                    "content": "Make git svn less verbose. Specify a second time to make it even less verbose.\n\n-m, --merge, -s<strategy>, --strategy=<strategy>, -p, --rebase-merges\nThese are only used with the dcommit and rebase commands.\n\nPassed directly to git rebase when using dcommit if a git reset cannot be used (see\ndcommit).\n",
                    "flag": "-q",
                    "long": "--quiet"
                },
                {
                    "name": "-n, --dry-run",
                    "content": "This can be used with the dcommit, rebase, branch and tag commands.\n\nFor dcommit, print out the series of Git arguments that would show which diffs would be\ncommitted to SVN.\n\nFor rebase, display the local branch associated with the upstream svn repository\nassociated with the current branch and the URL of svn repository that will be fetched\nfrom.\n\nFor branch and tag, display the urls that will be used for copying when creating the\nbranch or tag.\n",
                    "flag": "-n",
                    "long": "--dry-run"
                },
                {
                    "name": "--use-log-author",
                    "content": "When retrieving svn commits into Git (as part of fetch, rebase, or dcommit operations),\nlook for the first From: line or Signed-off-by trailer in the log message and use that as\nthe author string.\n\nconfig key: svn.useLogAuthor\n\n",
                    "long": "--use-log-author"
                },
                {
                    "name": "--add-author-from",
                    "content": "When committing to svn from Git (as part of set-tree or dcommit operations), if the\nexisting log message doesn’t already have a From: or Signed-off-by trailer, append a\nFrom: line based on the Git commit’s author string. If you use this, then\n--use-log-author will retrieve a valid author string for all commits.\n\nconfig key: svn.addAuthorFrom\n\n",
                    "long": "--add-author-from"
                }
            ]
        },
        "ADVANCED OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-i<GIT_SVN_ID>, --id <GIT_SVN_ID>",
                    "content": "This sets GITSVNID (instead of using the environment). This allows the user to override\nthe default refname to fetch from when tracking a single URL. The log and dcommit\ncommands no longer require this switch as an argument.\n",
                    "long": "--id",
                    "arg": "<GIT_SVN_ID>"
                },
                {
                    "name": "-R<remote name>, --svn-remote <remote name>",
                    "content": "Specify the [svn-remote \"<remote name>\"] section to use, this allows SVN multiple\nrepositories to be tracked. Default: \"svn\"\n",
                    "long": "--svn-remote"
                },
                {
                    "name": "--follow-parent",
                    "content": "This option is only relevant if we are tracking branches (using one of the repository\nlayout options --trunk, --tags, --branches, --stdlayout). For each tracked branch, try to\nfind out where its revision was copied from, and set a suitable parent in the first Git\ncommit for the branch. This is especially helpful when we’re tracking a directory that\nhas been moved around within the repository. If this feature is disabled, the branches\ncreated by git svn will all be linear and not share any history, meaning that there will\nbe no information on where branches were branched off or merged. However, following\nlong/convoluted histories can take a long time, so disabling this feature may speed up\nthe cloning process. This feature is enabled by default, use --no-follow-parent to\ndisable it.\n\nconfig key: svn.followparent\n\n",
                    "long": "--follow-parent"
                }
            ]
        },
        "CONFIG FILE-ONLY OPTIONS": {
            "content": "svn.noMetadata, svn-remote.<name>.noMetadata\nThis gets rid of the git-svn-id: lines at the end of every commit.\n\nThis option can only be used for one-shot imports as git svn will not be able to fetch\nagain without metadata. Additionally, if you lose your $GITDIR/svn//.revmap.*  files,\ngit svn will not be able to rebuild them.\n\nThe git svn log command will not work on repositories using this, either. Using this\nconflicts with the useSvmProps option for (hopefully) obvious reasons.\n\nThis option is NOT recommended as it makes it difficult to track down old references to\nSVN revision numbers in existing documentation, bug reports, and archives. If you plan to\neventually migrate from SVN to Git and are certain about dropping SVN history, consider\ngit-filter-repo[1] instead. filter-repo also allows reformatting of metadata for\nease-of-reading and rewriting authorship info for non-\"svn.authorsFile\" users.\n\nsvn.useSvmProps, svn-remote.<name>.useSvmProps\nThis allows git svn to re-map repository URLs and UUIDs from mirrors created using\nSVN::Mirror (or svk) for metadata.\n\nIf an SVN revision has a property, \"svm:headrev\", it is likely that the revision was\ncreated by SVN::Mirror (also used by SVK). The property contains a repository UUID and a\nrevision. We want to make it look like we are mirroring the original URL, so introduce a\nhelper function that returns the original identity URL and UUID, and use it when\ngenerating metadata in commit messages.\n\nsvn.useSvnsyncProps, svn-remote.<name>.useSvnsyncprops\nSimilar to the useSvmProps option; this is for users of the svnsync(1) command\ndistributed with SVN 1.4.x and later.\n\nsvn-remote.<name>.rewriteRoot\nThis allows users to create repositories from alternate URLs. For example, an\nadministrator could run git svn on the server locally (accessing via file://) but wish to\ndistribute the repository with a public http:// or svn:// URL in the metadata so users of\nit will see the public URL.\n\nsvn-remote.<name>.rewriteUUID\nSimilar to the useSvmProps option; this is for users who need to remap the UUID manually.\nThis may be useful in situations where the original UUID is not available via either\nuseSvmProps or useSvnsyncProps.\n\nsvn-remote.<name>.pushurl\nSimilar to Git’s remote.<name>.pushurl, this key is designed to be used in cases where\nurl points to an SVN repository via a read-only transport, to provide an alternate\nread/write transport. It is assumed that both keys point to the same repository. Unlike\ncommiturl, pushurl is a base path. If either commiturl or pushurl could be used,\ncommiturl takes precedence.\n\nsvn.brokenSymlinkWorkaround\nThis disables potentially expensive checks to workaround broken symlinks checked into SVN\nby broken clients. Set this option to \"false\" if you track a SVN repository with many\nempty blobs that are not symlinks. This option may be changed while git svn is running\nand take effect on the next revision fetched. If unset, git svn assumes this option to be\n\"true\".\n\nsvn.pathnameencoding\nThis instructs git svn to recode pathnames to a given encoding. It can be used by windows\nusers and by those who work in non-utf8 locales to avoid corrupted file names with\nnon-ASCII characters. Valid encodings are the ones supported by Perl’s Encode module.\n\nsvn-remote.<name>.automkdirs\nNormally, the \"git svn clone\" and \"git svn rebase\" commands attempt to recreate empty\ndirectories that are in the Subversion repository. If this option is set to \"false\", then\nempty directories will only be created if the \"git svn mkdirs\" command is run explicitly.\nIf unset, git svn assumes this option to be \"true\".\n\nSince the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and useSvmProps options all\naffect the metadata generated and used by git svn; they must be set in the configuration file\nbefore any history is imported and these settings should never be changed once they are set.\n\nAdditionally, only one of these options can be used per svn-remote section because they\naffect the git-svn-id: metadata line, except for rewriteRoot and rewriteUUID which can be\nused together.\n",
            "subsections": []
        },
        "BASIC EXAMPLES": {
            "content": "Tracking and contributing to the trunk of a Subversion-managed project (ignoring tags and\nbranches):\n\n# Clone a repo (like git clone):\ngit svn clone http://svn.example.com/project/trunk\n# Enter the newly cloned directory:\ncd trunk\n# You should be on master branch, double-check with 'git branch'\ngit branch\n# Do some work and commit locally to Git:\ngit commit ...\n# Something is committed to SVN, rebase your local changes against the\n# latest changes in SVN:\ngit svn rebase\n# Now commit your changes (that were committed previously using Git) to SVN,\n# as well as automatically updating your working HEAD:\ngit svn dcommit\n# Append svn:ignore settings to the default Git exclude file:\ngit svn show-ignore >> .git/info/exclude\n\n\nTracking and contributing to an entire Subversion-managed project (complete with a trunk,\ntags and branches):\n\n# Clone a repo with standard SVN directory layout (like git clone):\ngit svn clone http://svn.example.com/project --stdlayout --prefix svn/\n# Or, if the repo uses a non-standard directory layout:\ngit svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/\n# View all branches and tags you have cloned:\ngit branch -r\n# Create a new branch in SVN\ngit svn branch waldo\n# Reset your master to trunk (or any other branch, replacing 'trunk'\n# with the appropriate name):\ngit reset --hard svn/trunk\n# You may only dcommit to one branch/tag/trunk at a time.  The usage\n# of dcommit/rebase/show-ignore should be the same as above.\n\n\nThe initial git svn clone can be quite time-consuming (especially for large Subversion\nrepositories). If multiple people (or one person with multiple machines) want to use git svn\nto interact with the same Subversion repository, you can do the initial git svn clone to a\nrepository on a server and have each person clone that repository with git clone:\n\n# Do the initial import on a server\nssh server \"cd /pub && git svn clone http://svn.example.com/project [options...]\"\n# Clone locally - make sure the refs/remotes/ space matches the server\nmkdir project\ncd project\ngit init\ngit remote add origin server:/pub/project\ngit config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'\ngit fetch\n# Prevent fetch/pull from remote Git server in the future,\n# we only want to use git svn for future updates\ngit config --remove-section remote.origin\n# Create a local branch from one of the branches just fetched\ngit checkout -b master FETCHHEAD\n# Initialize 'git svn' locally (be sure to use the same URL and\n# --stdlayout/-T/-b/-t/--prefix options as were used on server)\ngit svn init http://svn.example.com/project [options...]\n# Pull the latest changes from Subversion\ngit svn rebase\n\n",
            "subsections": [
                {
                    "name": "REBASE VS. PULL/MERGE",
                    "content": "Prefer to use git svn rebase or git rebase, rather than git pull or git merge to synchronize\nunintegrated commits with a git svn branch. Doing so will keep the history of unintegrated\ncommits linear with respect to the upstream SVN repository and allow the use of the preferred\ngit svn dcommit subcommand to push unintegrated commits back into SVN.\n\nOriginally, git svn recommended that developers pulled or merged from the git svn branch.\nThis was because the author favored git svn set-tree B to commit a single head rather than\nthe git svn set-tree A..B notation to commit multiple commits. Use of git pull or git merge\nwith git svn set-tree A..B will cause non-linear history to be flattened when committing into\nSVN and this can lead to merge commits unexpectedly reversing previous commits in SVN.\n"
                }
            ]
        },
        "MERGE TRACKING": {
            "content": "While git svn can track copy history (including branches and tags) for repositories adopting\na standard layout, it cannot yet represent merge history that happened inside git back\nupstream to SVN users. Therefore it is advised that users keep history as linear as possible\ninside Git to ease compatibility with SVN (see the CAVEATS section below).\n",
            "subsections": []
        },
        "HANDLING OF SVN BRANCHES": {
            "content": "If git svn is configured to fetch branches (and --follow-branches is in effect), it sometimes\ncreates multiple Git branches for one SVN branch, where the additional branches have names of\nthe form branchname@nnn (with nnn an SVN revision number). These additional branches are\ncreated if git svn cannot find a parent commit for the first commit in an SVN branch, to\nconnect the branch to the history of the other branches.\n\nNormally, the first commit in an SVN branch consists of a copy operation. git svn will read\nthis commit to get the SVN revision the branch was created from. It will then try to find the\nGit commit that corresponds to this SVN revision, and use that as the parent of the branch.\nHowever, it is possible that there is no suitable Git commit to serve as parent. This will\nhappen, among other reasons, if the SVN branch is a copy of a revision that was not fetched\nby git svn (e.g. because it is an old revision that was skipped with --revision), or if in\nSVN a directory was copied that is not tracked by git svn (such as a branch that is not\ntracked at all, or a subdirectory of a tracked branch). In these cases, git svn will still\ncreate a Git branch, but instead of using an existing Git commit as the parent of the branch,\nit will read the SVN history of the directory the branch was copied from and create\nappropriate Git commits. This is indicated by the message \"Initializing parent:\n<branchname>\".\n\nAdditionally, it will create a special branch named <branchname>@<SVN-Revision>, where\n<SVN-Revision> is the SVN revision number the branch was copied from. This branch will point\nto the newly created parent commit of the branch. If in SVN the branch was deleted and later\nrecreated from a different version, there will be multiple such branches with an @.\n\nNote that this may mean that multiple Git commits are created for a single SVN revision.\n\nAn example: in an SVN repository with a standard trunk/tags/branches layout, a directory\ntrunk/sub is created in r.100. In r.200, trunk/sub is branched by copying it to branches/.\ngit svn clone -s will then create a branch sub. It will also create new Git commits for r.100\nthrough r.199 and use these as the history of branch sub. Thus there will be two Git commits\nfor each revision from r.100 to r.199 (one containing trunk/, one containing trunk/sub/).\nFinally, it will create a branch sub@200 pointing to the new parent commit of branch sub\n(i.e. the commit for r.200 and trunk/sub/).\n",
            "subsections": []
        },
        "CAVEATS": {
            "content": "For the sake of simplicity and interoperating with Subversion, it is recommended that all git\nsvn users clone, fetch and dcommit directly from the SVN server, and avoid all git\nclone/pull/merge/push operations between Git repositories and branches. The recommended\nmethod of exchanging code between Git branches and users is git format-patch and git am, or\njust 'dcommit’ing to the SVN repository.\n\nRunning git merge or git pull is NOT recommended on a branch you plan to dcommit from because\nSubversion users cannot see any merges you’ve made. Furthermore, if you merge or pull from a\nGit branch that is a mirror of an SVN branch, dcommit may commit to the wrong branch.\n\nIf you do merge, note the following rule: git svn dcommit will attempt to commit on top of\nthe SVN commit named in\n\ngit log --grep=^git-svn-id: --first-parent -1\n\n\nYou must therefore ensure that the most recent commit of the branch you want to dcommit to is\nthe first parent of the merge. Chaos will ensue otherwise, especially if the first parent is\nan older commit on the same SVN branch.\n\ngit clone does not clone branches under the refs/remotes/ hierarchy or any git svn metadata,\nor config. So repositories created and managed with using git svn should use rsync for\ncloning, if cloning is to be done at all.\n\nSince dcommit uses rebase internally, any Git branches you git push to before dcommit on will\nrequire forcing an overwrite of the existing ref on the remote repository. This is generally\nconsidered bad practice, see the git-push(1) documentation for details.\n\nDo not use the --amend option of git-commit(1) on a change you’ve already dcommitted. It is\nconsidered bad practice to --amend commits you’ve already pushed to a remote repository for\nother users, and dcommit with SVN is analogous to that.\n\nWhen cloning an SVN repository, if none of the options for describing the repository layout\nis used (--trunk, --tags, --branches, --stdlayout), git svn clone will create a Git\nrepository with completely linear history, where branches and tags appear as separate\ndirectories in the working copy. While this is the easiest way to get a copy of a complete\nrepository, for projects with many branches it will lead to a working copy many times larger\nthan just the trunk. Thus for projects using the standard directory structure\n(trunk/branches/tags), it is recommended to clone with option --stdlayout. If the project\nuses a non-standard structure, and/or if branches and tags are not required, it is easiest to\nonly clone one directory (typically trunk), without giving any repository layout options. If\nthe full history with branches and tags is required, the options --trunk / --branches /\n--tags must be used.\n\nWhen using multiple --branches or --tags, git svn does not automatically handle name\ncollisions (for example, if two branches from different paths have the same name, or if a\nbranch and a tag have the same name). In these cases, use init to set up your Git repository\nthen, before your first fetch, edit the $GITDIR/config file so that the branches and tags\nare associated with different name spaces. For example:\n\nbranches = stable/*:refs/remotes/svn/stable/*\nbranches = debug/*:refs/remotes/svn/debug/*\n",
            "subsections": []
        },
        "CONFIGURATION": {
            "content": "git svn stores [svn-remote] configuration information in the repository $GITDIR/config file.\nIt is similar the core Git [remote] sections except fetch keys do not accept glob arguments;\nbut they are instead handled by the branches and tags keys. Since some SVN repositories are\noddly configured with multiple projects glob expansions such those listed below are allowed:\n\n[svn-remote \"project-a\"]\nurl = http://server.org/svn\nfetch = trunk/project-a:refs/remotes/project-a/trunk\nbranches = branches/*/project-a:refs/remotes/project-a/branches/*\nbranches = branches/release*:refs/remotes/project-a/branches/release*\nbranches = branches/re*se:refs/remotes/project-a/branches/*\ntags = tags/*/project-a:refs/remotes/project-a/tags/*\n\n\nKeep in mind that the * (asterisk) wildcard of the local ref (right of the :) must be the\nfarthest right path component; however the remote wildcard may be anywhere as long as it’s an\nindependent path component (surrounded by / or EOL). This type of configuration is not\nautomatically created by init and should be manually entered with a text-editor or using git\nconfig.\n\nAlso note that only one asterisk is allowed per word. For example:\n\nbranches = branches/re*se:refs/remotes/project-a/branches/*\n\nwill match branches release, rese, re123se, however\n\nbranches = branches/re*s*e:refs/remotes/project-a/branches/*\n\nwill produce an error.\n\nIt is also possible to fetch a subset of branches or tags by using a comma-separated list of\nnames within braces. For example:\n\n[svn-remote \"huge-project\"]\nurl = http://server.org/svn\nfetch = trunk/src:refs/remotes/trunk\nbranches = branches/{red,green}/src:refs/remotes/project-a/branches/*\ntags = tags/{1.0,2.0}/src:refs/remotes/project-a/tags/*\n\n\nMultiple fetch, branches, and tags keys are supported:\n\n[svn-remote \"messy-repo\"]\nurl = http://server.org/svn\nfetch = trunk/project-a:refs/remotes/project-a/trunk\nfetch = branches/demos/june-project-a-demo:refs/remotes/project-a/demos/june-demo\nbranches = branches/server/*:refs/remotes/project-a/branches/*\nbranches = branches/demos/2011/*:refs/remotes/project-a/2011-demos/*\ntags = tags/server/*:refs/remotes/project-a/tags/*\n\n\nCreating a branch in such a configuration requires disambiguating which location to use using\nthe -d or --destination flag:\n\n$ git svn branch -d branches/server release-2-3-0\n\n\nNote that git-svn keeps track of the highest revision in which a branch or tag has appeared.\nIf the subset of branches or tags is changed after fetching, then $GITDIR/svn/.metadata must\nbe manually edited to remove (or reset) branches-maxRev and/or tags-maxRev as appropriate.\n",
            "subsections": []
        },
        "FILES": {
            "content": "$GITDIR/svn//.revmap.*\nMapping between Subversion revision numbers and Git commit names. In a repository where\nthe noMetadata option is not set, this can be rebuilt from the git-svn-id: lines that are\nat the end of every commit (see the svn.noMetadata section above for details).\n\ngit svn fetch and git svn rebase automatically update the revmap if it is missing or not\nup to date.  git svn reset automatically rewinds it.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "We ignore all SVN properties except svn:executable. Any unhandled properties are logged to\n$GITDIR/svn/<refname>/unhandled.log\n\nRenamed and copied directories are not detected by Git and hence not tracked when committing\nto SVN. I do not plan on adding support for this as it’s quite difficult and time-consuming\nto get working for all the possible corner cases (Git doesn’t do it, either). Committing\nrenamed and copied files is fully supported if they’re similar enough for Git to detect them.\n\nIn SVN, it is possible (though discouraged) to commit changes to a tag (because a tag is just\na directory copy, thus technically the same as a branch). When cloning an SVN repository, git\nsvn cannot know if such a commit to a tag will happen in the future. Thus it acts\nconservatively and imports all SVN tags as branches, prefixing the tag name with tags/.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "git-rebase(1)\n",
            "subsections": []
        },
        "GIT": {
            "content": "Part of the git(1) suite\n",
            "subsections": []
        },
        "NOTES": {
            "content": "1. git-filter-repo\nhttps://github.com/newren/git-filter-repo\n\n\n\nGit 2.34.1                                   02/26/2026                                   GIT-SVN(1)",
            "subsections": []
        }
    },
    "summary": "git-svn - Bidirectional operation between a Subversion repository and Git",
    "flags": [
        {
            "flag": "-r",
            "long": "--revision",
            "arg": "<arg>",
            "description": "Used with the fetch command. This allows revision ranges for partial/cauterized history to be supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges), $NUMBER:HEAD, and BASE:$NUMBER are all supported. This can allow you to make partial mirrors when running fetch; but is generally not recommended because history will be skipped and lost. -, --stdin Only used with the set-tree command. Read a list of commits from stdin and commit them in reverse order. Only the leading sha1 is read from each line, so git rev-list --pretty=oneline output can be used."
        },
        {
            "flag": "",
            "long": "--rmdir",
            "arg": null,
            "description": "Only used with the dcommit, set-tree and commit-diff commands. Remove directories from the SVN tree if there are no files left behind. SVN can version empty directories, and they are not removed by default if there are no files left in them. Git cannot version empty directories. Enabling this flag will make the commit to SVN act like Git. config key: svn.rmdir"
        },
        {
            "flag": "-e",
            "long": "--edit",
            "arg": null,
            "description": "Only used with the dcommit, set-tree and commit-diff commands. Edit the commit message before committing to SVN. This is off by default for objects that are commits, and forced on when committing tree objects. config key: svn.edit"
        },
        {
            "flag": "",
            "long": "--find-copies-harder",
            "arg": null,
            "description": "Only used with the dcommit, set-tree and commit-diff commands. They are both passed directly to git diff-tree; see git-diff-tree(1) for more information. config key: svn.l config key: svn.findcopiesharder -A<filename>, --authors-file=<filename> Syntax is compatible with the file used by git cvsimport but an empty email address can be supplied with <>: loginname = Joe User <user@example.com> If this option is specified and git svn encounters an SVN committer name that does not exist in the authors-file, git svn will abort operation. The user will then have to add the appropriate entry. Re-running the previous git svn command after the authors-file is modified should continue operation. config key: svn.authorsfile --authors-prog=<filename> If this option is specified, for each SVN committer name that does not exist in the authors file, the given file is executed with the committer name as the first argument. The program is expected to return a single line of the form \"Name <email>\" or \"Name <>\", which will be treated as if included in the authors file. Due to historical reasons a relative filename is first searched relative to the current directory for init and clone and relative to the root of the working tree for fetch. If filename is not found, it is searched like any other command in $PATH. config key: svn.authorsProg"
        },
        {
            "flag": "-q",
            "long": "--quiet",
            "arg": null,
            "description": "Make git svn less verbose. Specify a second time to make it even less verbose. -m, --merge, -s<strategy>, --strategy=<strategy>, -p, --rebase-merges These are only used with the dcommit and rebase commands. Passed directly to git rebase when using dcommit if a git reset cannot be used (see dcommit)."
        },
        {
            "flag": "-n",
            "long": "--dry-run",
            "arg": null,
            "description": "This can be used with the dcommit, rebase, branch and tag commands. For dcommit, print out the series of Git arguments that would show which diffs would be committed to SVN. For rebase, display the local branch associated with the upstream svn repository associated with the current branch and the URL of svn repository that will be fetched from. For branch and tag, display the urls that will be used for copying when creating the branch or tag."
        },
        {
            "flag": "",
            "long": "--use-log-author",
            "arg": null,
            "description": "When retrieving svn commits into Git (as part of fetch, rebase, or dcommit operations), look for the first From: line or Signed-off-by trailer in the log message and use that as the author string. config key: svn.useLogAuthor"
        },
        {
            "flag": "",
            "long": "--add-author-from",
            "arg": null,
            "description": "When committing to svn from Git (as part of set-tree or dcommit operations), if the existing log message doesn’t already have a From: or Signed-off-by trailer, append a From: line based on the Git commit’s author string. If you use this, then --use-log-author will retrieve a valid author string for all commits. config key: svn.addAuthorFrom"
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "git-rebase",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/git-rebase/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Bidirectional operation between a Subversion repository and Git.",
        "examples": [
            {
                "description": "Clone an SVN repository",
                "command": "git svn clone {{https://example.com/subversion_repo}} {{local_directory}}"
            },
            {
                "description": "Clone an SVN repository starting at a given revision number",
                "command": "git svn clone {{-r|--revision}} {{1234}}:HEAD {{https://svn.example.net/subversion/repo}} {{local_directory}}"
            },
            {
                "description": "Update local clone from the remote SVN repository",
                "command": "git svn rebase"
            },
            {
                "description": "Fetch updates from the remote SVN repository without changing the Git `HEAD`",
                "command": "git svn fetch"
            },
            {
                "description": "Commit back to the SVN repository",
                "command": "git svn commit"
            }
        ]
    }
}