Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在SVN到Git迁移之后,如何列出和获取远程分支?_Svn_Git_Migration_Branch_Git Svn - Fatal编程技术网

在SVN到Git迁移之后,如何列出和获取远程分支?

在SVN到Git迁移之后,如何列出和获取远程分支?,svn,git,migration,branch,git-svn,Svn,Git,Migration,Branch,Git Svn,我将我们的SVN存储库迁移到Git,并将其推送到一个中央存储库。我们有大量的标记和分支,但不知何故,我们无法从Git客户端列出和获取这些标记和分支。这很奇怪,因为标记和分支似乎在服务器上可用 在a、a和a的帮助下,我能够将一个解决方案缝合在一起。谢谢你的帮助 这就是我最后做的。首先,我使用svn提交者创建了一个文件: local$ svn log svn://server/opt/svn/our_app |grep ^r[0-9] | cut -f2 -d\| |sort |uniq | tee

我将我们的SVN存储库迁移到Git,并将其推送到一个中央存储库。我们有大量的标记和分支,但不知何故,我们无法从Git客户端列出和获取这些标记和分支。这很奇怪,因为标记和分支似乎在服务器上可用

在a、a和a的帮助下,我能够将一个解决方案缝合在一起。谢谢你的帮助

这就是我最后做的。首先,我使用svn提交者创建了一个文件:

local$ svn log svn://server/opt/svn/our_app |grep ^r[0-9] | cut -f2 -d\| |sort |uniq | tee ~/users.txt
alice
bob
eve
local$ vim ~/users.txt
local$ cat ~/users.txt
alice = Alice Malice <alice@malice.doh> 
bob = Bob Hope <bob@hope.doh>
eve = Eve Leave <eve@leave.doh>
最后一步至关重要,因为从远程存储库克隆时,分支/标记不可用。无论如何,我把这个推到了一个新的远程回购:

local$ ssh server
server$ mkdir /opt/git/our_app.git
server$ cd /opt/git/our_app.git
server$ git --bare init
server$ git config core.sharedrepository 1
server$ git config receive.denyNonFastforwards true
server$ find objects -type d -exec chmod 02770 {} \;
server$ exit
local$ git remote add origin ssh://server/opt/git/our_app.git
local$ git push --mirror
远程存储库的新克隆显示,一切都可用:

local$ git clone ssh://server/opt/git/our_app.git
local$ cd our_app
local$ git branch -a
* master
  remotes/origin/master
  remotes/origin/pre-svn-move
  remotes/origin/tags/mytag-0.1
  remotes/origin/tags/mytag-0.2
  remotes/origin/trunk
  remotes/origin/mybranch-1
  remotes/origin/mybranch-2
现在可以签出远程分支:

local$ git checkout -t origin/mybranch-1
local$ git branch
  master
* mybranch-1
只是重复一下:本指南包括关于远程标记和分支可用性、镜像到远程repo以及svn:ignore中值的重用的提示。我之前没有在一本指南中找到所有这些


最后一点注意:这也很棒,因为这一个实际上将标记保留为标记,而git svn将它们转换为分支。另一方面,我无法让“git svn create ignore”使用svn2git…

在您的序列中,我能找到的唯一可疑命令是

git config branch.master.remote origin
首先,您的第一个本地回购(来自
git svn fetch
)应该有分支,而不是远程分支

其次,您的服务器repo(具有正确的分支)应该能够与其所有引用一起克隆,这意味着第二个本地repo应该列出所有远程分支


您是否可以在不使用git config branch.master.remote origin的情况下尝试使用
git svn fetch

如果这是一种单向转换(永远不要返回到svn),我强烈建议使用,因为它大大简化了整个过程。要进行转换,基本上是这样做的

svn2git <svn repo url> --authors <author names & emails file>
git remote add origin <git bare repo url>
git push --all
git push --tags
svn2git——作者
git远程添加源
git推——全部
git推送标签

。。。这就是它的全部内容。

分支从一开始就显示为远程,紧跟在“git svn fetch”之后。“git config branch.master.remote origin”似乎没有任何效果,我已经尝试了整个序列,但没有它。@neu242:有趣。我不明白的是,为什么在推镜像之后,这些分支会在服务器repo中列出。无论如何,对于第一个本地repo,尝试在将其推送到裸repo之前跟踪所有远程分支:好的,在初始推之前,我对所有分支执行了“git branch--track”。现在,列出的所有分支/标记与“remotes/tags/mytag-0.1”和“tags/mytag-0.1”类似。然后我做了一个“git push--mirror”。所有标记和分支现在在服务器上列出两次(不带remotes/*)。但是在一个新的“git克隆”之后ssh://server/opt/git/our_app.git在客户机上,“git branch-r”按应有的顺序列出所有标记/分支(而不是两次)。所以这很好。我应该担心被骗的人吗?有点奇怪。如果我执行“git checkout-b mybranch-1 origin/mybranch-1”,我会得到最新的主干。ebneter:是的,昨天在看到你的答案之前,我试过nirvdrum的svn2git(有好几种!),效果非常好!它甚至正确地完成了标记,而git svn却没有。现在唯一的问题是,以前的文件夹移动没有正确注册:当我将branch1/content与branch2/moved\u here/content进行区分时,它会比较根文件夹……这些是在转换之前完成的移动吗?或者之后?不幸的是,这不会推送分支,因为svn2git将所有分支置于远程控制之下/****
svn2git <svn repo url> --authors <author names & emails file>
git remote add origin <git bare repo url>
git push --all
git push --tags