Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the --stdlayout do in git svn clone?

Tags:

git

svn

git-svn

I just spotted this question about recovering from a clone done without --stdlayout. I didn't find documentation of this flag - what does it do?

like image 850
ripper234 Avatar asked Mar 19 '11 10:03

ripper234


People also ask

What does Git SVN clone do?

The git svn clone command transforms the trunk, branches, and tags in your SVN repository into a new Git repository. Depending on the structure of your SVN repo, the command needs to be configured differently.

How do I clone a SVN repository?

# 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 ...


2 Answers

Subversion doesn't have any concept of branch or tag. Instead, those are typically simulated by simply copying the contents of the repository into a directory.

In order for git svn to be able to recognize branches and tags and the main branch ("trunk"), you have to explicitly tell it where to find them, using the --tags (or -t), --branches (or -b) and --trunk (or -T) options.

However, many Subversion repositories follow a standard convention, laid out in the Subversion book, of --trunk=/trunk --branches=/branches --tags=/tags. --stdlayout (or -s) encodes this convention, so that you don't have to pass the same arguments every time you clone a Subversion repository.

You can find this information in the git-svn(1) manual page, which you can access under Unix with man git-svn and in an operating system independent fashion via the builtin Git help system with git help svn. All of the Git man pages are also available on Kernel.Org and they are usually the first search result when you search for git-svn(1).

like image 154
Jörg W Mittag Avatar answered Sep 28 '22 16:09

Jörg W Mittag


--stdlayout (-s) tells git-svn that folders in /branches should be imported as branches, and that folders in /tags are snapshots of a project state and should be imported as tags. The master branch will be set to /trunk.

It's equivalent to --trunk=trunk --tags=tags --branches=branches

like image 22
knittl Avatar answered Sep 28 '22 18:09

knittl