Home Explore Blog CI



git

11th chunk of `Documentation/git-svn.adoc`
1e1faaa7a18ac3e9ff2d03bfa13095bbc63c5bdcfc4fe76d0000000100000fa3

	while 'git svn' is running and take effect on the next
	revision fetched.  If unset, 'git svn' assumes this option to
	be "true".

svn.pathnameencoding::
	This instructs git svn to recode pathnames to a given encoding.
	It can be used by windows users and by those who work in non-utf8
	locales to avoid corrupted file names with non-ASCII characters.
	Valid encodings are the ones supported by Perl's Encode module.

svn-remote.<name>.automkdirs::
	Normally, the "git svn clone" and "git svn rebase" commands
	attempt to recreate empty directories that are in the
	Subversion repository.  If this option is set to "false", then
	empty directories will only be created if the "git svn mkdirs"
	command is run explicitly.  If unset, 'git svn' assumes this
	option to be "true".

Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and useSvmProps
options all affect the metadata generated and used by 'git svn'; they
*must* be set in the configuration file before any history is imported
and these settings should never be changed once they are set.

Additionally, only one of these options can be used per svn-remote
section because they affect the 'git-svn-id:' metadata line, except
for rewriteRoot and rewriteUUID which can be used together.


BASIC EXAMPLES
--------------

Tracking and contributing to the trunk of a Subversion-managed project
(ignoring tags and branches):

------------------------------------------------------------------------
# Clone a repo (like git clone):
	git svn clone http://svn.example.com/project/trunk
# Enter the newly cloned directory:
	cd trunk
# You should be on master branch, double-check with 'git branch'
	git branch
# Do some work and commit locally to Git:
	git commit ...
# Something is committed to SVN, rebase your local changes against the
# latest changes in SVN:
	git svn rebase
# Now commit your changes (that were committed previously using Git) to SVN,
# as well as automatically updating your working HEAD:
	git svn dcommit
# Append svn:ignore and svn:global-ignores settings to the default Git exclude file:
	git svn show-ignore >> .git/info/exclude
------------------------------------------------------------------------

Tracking and contributing to an entire Subversion-managed project
(complete with a trunk, tags and branches):

------------------------------------------------------------------------
# Clone a repo with standard SVN directory layout (like git clone):
	git svn clone http://svn.example.com/project --stdlayout --prefix svn/
# Or, if the repo uses a non-standard directory layout:
	git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/
# View all branches and tags you have cloned:
	git branch -r
# Create a new branch in SVN
	git svn branch waldo
# Reset your master to trunk (or any other branch, replacing 'trunk'
# with the appropriate name):
	git reset --hard svn/trunk
# You may only dcommit to one branch/tag/trunk at a time.  The usage
# of dcommit/rebase/show-ignore should be the same as above.
------------------------------------------------------------------------

The initial 'git svn clone' can be quite time-consuming
(especially for large Subversion repositories). If multiple
people (or one person with multiple machines) want to use
'git svn' to interact with the same Subversion repository, you can
do the initial 'git svn clone' to a repository on a server and
have each person clone that repository with 'git clone':

------------------------------------------------------------------------
# Do the initial import on a server
	ssh server "cd /pub && git svn clone http://svn.example.com/project [options...]"
# Clone locally - make sure the refs/remotes/ space matches the server
	mkdir project
	cd project
	git init
	git remote add origin server:/pub/project
	git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
	git fetch
# Prevent fetch/pull from remote Git server in the future,
# we only want to use git svn for future updates

Title: Git SVN Configuration and Basic Usage Examples
Summary
This section outlines the configuration options for git-svn, including pathname encoding and automatic directory creation, and provides basic examples of how to track and contribute to Subversion-managed projects using git-svn, including cloning, committing, and rebasing.