Using Git with a Subversion repository
Using Git as a client of Subversion can raise some confusions, due to the flexibility of Git as compared to the more rigid way Subversion organizes files. To be sure to maintain a Subversion-friendly way of work, I recommend you follow some simple rules.
First of all, ensure that your Git master
branch is related to the trunk
one in Subversion; as we already said, Subversion users usually organize a repository in this way:
- A
/trunk
folder, the main one - A
/branches
root folder, where you put all the branches, each one located in a separated subfolder (for example,/branches/feat-branch
) - A
/tags
root folder, where you collect all the tags you made (for example,/tags/v1.0.0
)
To adhere to this layout, you can use the --stdlayout
option when cloning a Subversion repository:
$ git svn clone <url> --stdlayout
In this manner, Git will hook the /trunk
Subversion branch to the Git master
one, then replicate all the /branches
and /tags
branches in your local Git...