组合多个git仓库,其名称中有一个空格 [英] Combining multiple git repositories having a space in their name

查看:505
本文介绍了组合多个git仓库,其名称中有一个空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用这个问题的答案,包括git-filterbranch 结合多个git仓库,但在麻烦中运行,因为当存储库名称中包含空格时,此答案似乎不起作用。



例如,如果存储库是所谓的我的数字,而不是数字。

我正在运行msysgit。



这是一个示例,带有我的数字存储库,这是令人不快的:

  / d / git /我的数字(主)
$ git filter-branch --index-filter \
> 'git ls-files -s | seds-\t-& my figures / - |
> GIT_INDEX_FILE = $ GIT_INDEX_FILE.new \
> git update-index --index-info&&
> mv $ GIT_INDEX_FILE.new $ GIT_INDEX_FILE'HEAD
重写d9f3a10522f2a0e1531f45e8e7b3a518f0d714c5(1/1)mv:当移动多个文件时,最后一个参数必须是一个目录
尝试`mv --help'以获取更多信息。
索引过滤失败:git ls-files -s | seds-\t-& my figures / - |
GIT_INDEX_FILE = $ GIT_INDEX_FILE.new \
git update-index --index-info&&
mv $ GIT_INDEX_FILE.new $ GIT_INDEX_FILE
rm:无法删除`d:/ git / my figures / .git-rewrite / revs':Permission denied
rm:无法移除目录`d: / git / my figures / .git-rewrite':目录不为空

使用存储库重试
$ b

  / d / git / myfigures(master)
$ git filter-分支--index-filter'git ls-files -s | seds-\t-& myfigures / - |
GIT_INDEX_FILE = $ GIT_INDEX_FILE.new \
git update-index --index-info&&
mv $ GIT_INDEX_FILE.new $ GIT_INDEX_FILE'HEAD
Rewrite d9f3a10522f2a0e1531f45e8e7b3a518f0d714c5(1/1)
Ref'refs / heads / master'被改写

那么,如何调整这个git filter-branch调用以支持在其中有空间的存储库名称?

最后,我在git邮件列表上提出了这个问题:其中一位成员附带了一个答案:应该将一些引号添加到mv子命令中,他们已经更新了文档:查看来自 http://git-scm.com/docs/git-filter-branch的最后一个示例


I tried using the answer involing git-filterbranch from this question Combining multiple git repositories but running in trouble because this answer doesn't seems to work when repository name having a space in its name.

For example, this wouldn't work if the repository would be called "my figures" instead of "figures".

I'm running msysgit.

Here is a sample, with a "my figures" repository, wich is failling :

/d/git/my figures (master)
$ git filter-branch --index-filter \
> 'git ls-files -s | sed "s-\t-&my figures/-" |
> GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
> git update-index --index-info &&
> mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
Rewrite d9f3a10522f2a0e1531f45e8e7b3a518f0d714c5 (1/1)mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
index filter failed: git ls-files -s | sed "s-\t-&my figures/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &&
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE
rm: cannot remove `d:/git/my figures/.git-rewrite/revs': Permission denied
rm: cannot remove directory `d:/git/my figures/.git-rewrite': Directory not empty

The, retrying with the repository renamed a myfigures, wich is working fine :

/d/git/myfigures (master)
$ git filter-branch --index-filter 'git ls-files -s | sed "s-\t-&myfigures/-" |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
git update-index --index-info &&
mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD
Rewrite d9f3a10522f2a0e1531f45e8e7b3a518f0d714c5 (1/1)
Ref 'refs/heads/master' was rewritten

So, how tweaking this git filter-branch call to support repository name having a space in them ?

解决方案

I finally asked the question on the git mailing list: one of the member came with an answer : some quotes should be added to the mv sub-command, they have updated the documentation : see last sample from http://git-scm.com/docs/git-filter-branch

这篇关于组合多个git仓库,其名称中有一个空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆