git-svn:如何为SVN的子项目创建标签/分支
基于以下答案的命中。我找到了解决方案。
克隆 SVN:
$ git svn clone http://foo.net/code/design --trunk=trunk/proj1 --tags=tags/forProj1 --branches=branches/forProj1 localProjName然后是标签可以用简单的命令创建
$ git svn tag -n -m "test tag" test_v1
注意:这也可以通过本地 git 克隆中的 hack .git/config 来完成,方法是将其更改为
[svn-remote "svn"]
url = http://foo.net/code/design
fetch = trunk/proj1:refs/remotes/trunk
tags = tags/forProj1/*:refs/remotes/tags/*
branches = branches/forProj1/*:refs/remotes/branches/*
原始问题
我的 SVN 服务器结构是这样的:
http://foo.net/code/design/ |-- trunk/ | |-- proj1 | |-- proj2 |-- tags/ | |-- forProj1 | |-- forProj2 |-- branches/ | |-- forProj1
我签出 proj1:
$ git svn clone http://foo.net/code/design/trunk/proj1 proj1
我想为 proj1 创建一个标签将该标签放在 http://foo.net/code/design/tags/forproj1 下
我尝试过:
$ git svn tag -m "test tag for proj1" test_tag_1
我收到错误消息,说我必须输入“--destination”。但我不知道目的地选项应该是什么样子?
谁能给我一个提示,如何根据上述场景创建标签或分支?
谢谢。
Base on the hit from answers below. I found the solution.
Clone SVN:
$ git svn clone http://foo.net/code/design --trunk=trunk/proj1 --tags=tags/forProj1 --branches=branches/forProj1 localProjName
Then the tag can be created with simple command
$ git svn tag -n -m "test tag" test_v1
Notes: That can also be done by hack .git/config in the local git clone by change it as
[svn-remote "svn"]
url = http://foo.net/code/design
fetch = trunk/proj1:refs/remotes/trunk
tags = tags/forProj1/*:refs/remotes/tags/*
branches = branches/forProj1/*:refs/remotes/branches/*
Original Question
My SVN server structure is like this:
http://foo.net/code/design/ |-- trunk/ | |-- proj1 | |-- proj2 |-- tags/ | |-- forProj1 | |-- forProj2 |-- branches/ | |-- forProj1
I checkout the proj1:
$ git svn clone http://foo.net/code/design/trunk/proj1 proj1
and I want to create a tag for proj1 and put that tag under http://foo.net/code/design/tags/forproj1
I tried :
$ git svn tag -m "test tag for proj1" test_tag_1
I got error message said I have to put "--destination". But I don't know what the destination option should look like?
Can anyone give me a hint how could I create a tag or a branch base on above scenario?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,使用
-n
开关进行试运行,这样您就可以确保命令执行的操作是您想要执行的操作。使用SVN,否则,事情可能会变得一团糟。接下来,您的项目布局不是标准的,因此 git 不知道 project1 的标签会去哪里。在标准布局中,主干和标签将是兄弟,在这种情况下,您可以使用如下命令:
由于 SVN 标签可以直接在服务器上执行(即使没有 svn 签出),因此我的方法是运行 svn直接命令,如下所示:
然后正常的 git fetch 会更新“svn”远程命名空间下本地 git 中的标签 v1.2。
First, use a
-n
switch for dry run, so you can ensure what the command does is the thing you want done. With SVN, otherwise, it can be a mess.Next, your project layout is not the standard, so git wouldn't know where the tag for the project1 would go. In a standard layout, trunk and tags would be siblings, in that case you could have used a command like:
Since SVN tag can execute at the server directly (even without an svn checkout), my approach to do this would be run the svn command directly, like so:
and then a normal
git fetch
would have updated the tag v1.2 in the local git under the "svn" remote namespace.查看执行此操作时获得的值:
其中一个应该与您想要的标记位置匹配。
指定
--destination
Look at the values that you get when you do:
Once of these should match the tag location that you want.
Specify that for
--destination