【发布时间】:2014-12-14 19:12:42
【问题描述】:
我已将父存储库“objc4”从 https://github.com/RandomDSdevel/objc4 克隆到本地路径“/Volumes/Development/Repositories/objc4”。此父存储库包含一个子模块“OBJC4-437.1-Runtime”,我已将其设置为在本地路径“/Volumes/Development/Repositories/objc4/runtime”上镜像https://github.com/macmade/OBJC4-437.1-Runtime 的内容。我想将此子模块合并到其父存储库中,并且已经尝试使用these instructions here 这样做。在第一次“警告!”之后,我参与了这个程序。文本中的部分,其作者指示将子模块指向的存储库的第二个副本克隆到与子模块的父存储库所在的目录相同的目录中,并运行他提供的脚本。根据我在博客文章的讨论部分中添加的一些 here 包含我一直提到的过程,即使在从 OS X 10.9.5 'Mavericks' 更新到 OS 之后,我仍然会收到来自该脚本的错误X 10.10.0 '优胜美地'。在我第一次尝试后,我再次尝试无济于事,显示在我对他的博客文章的第一条评论中,并且将包含我第二次尝试的足够输出,以便了解我在下面收到的错误消息。不过,我做错了什么?我是否从错误的目录运行 shell 脚本?我没有给它正确的文件路径吗?
第二次脚本运行尝试:
Bryces-HD-1-TB:runtime bryce$ /Users/bryce/Downloads/git-rewrite-to-subfolder
This script rewrites your entire history, moving the current repository root into a subdirectory. This can be useful if you want to merge a submodule into its parent repository.
For example, your main repository might contain a submodule at the path src/lib/, containing a file called "test.c". If you would merge the submodule into the parent repository without further modification, all the commits to "test.c" will have the path "/test.c", whereas the file now actually lives in "src/lib/test.c".
If you rewrite your history using this script, adding "src/lib/" to the path and the merging into the parent repository, all paths will be correct.
NOTE: This script might complete garble your repository, so PLEASE apply this only to a clone of the repository where it does not matter if the repo is destroyed.
Do you want to proceed? (y/n) y
Please provide the path which should be prepended to the current root. In the above example, that would be "src/lib". Please note that the path MUST NOT contain a trailing slash.
Please provide the desired path (e.g. 'src/lib'): /Volumes/Development/Repositories/objc4/runtime
100644 f14f44cb3b69631fac2463fad25cd3b40b4dbc5b 0 /Volumes/Development/Repositories/objc4/runtime/.gitignore
100644 5342bd2b09a64ea93e3587d5d3e9d97966871555 0 /Volumes/Development/Repositories/objc4/runtime/Accessors.subproj:/objc-accessors.h
100644 d1e5617d8b3ed55f1d32e65f8af75c3ab914dc26 0 /Volumes/Development/Repositories/objc4/runtime/Accessors.subproj:/objc-accessors.m
100644 4b4584b9e7bd196fb0c1906b3ebcb37af52eac31 0 /Volumes/Development/Repositories/objc4/runtime/Auto.subproj/objc-auto-i386.s
100644 c3f7332252a2b17f5d6a7e06bbd370f68909ce9f 0 /Volumes/Development/Repositories/objc4/runtime/Auto.subproj/objc-auto-ppc.s
⋮
100644 b48f5e3581a430edc7984d7a72f6044d2618746c 0 /Volumes/Development/Repositories/objc4/runtime/objc.h
100644 af2830174561fa3a8d4a19996190992a8fa0f850 0 /Volumes/Development/Repositories/objc4/runtime/objcrt.c
100644 b3995456f9ee5860970abf496f2a2de591bfb4d9 0 /Volumes/Development/Repositories/objc4/runtime/objcrt.h
100644 c6047bbdb38ed2cd9d2bb7fee2d653d063874070 0 /Volumes/Development/Repositories/objc4/runtime/runtime.h
Please take a look at the printed file list. Does it look correct? (y/n) y
Rewrite 50d5519c12723f5d9ec2170bc45c144b25a8107e (1/5)Ignoring path /Volumes/Development/Repositories/objc4/runtime/Accessors.subproj:/objc-accessors.h
Ignoring path /Volumes/Development/Repositories/objc4/runtime/Accessors.subproj:/objc-accessors.m
Ignoring path /Volumes/Development/Repositories/objc4/runtime/Auto.subproj/objc-auto-i386.s
Ignoring path /Volumes/Development/Repositories/objc4/runtime/Auto.subproj/objc-auto-ppc.s
⋮
Ignoring path /Volumes/Development/Repositories/objc4/runtime/objc.h
Ignoring path /Volumes/Development/Repositories/objc4/runtime/objcrt.c
Ignoring path /Volumes/Development/Repositories/objc4/runtime/objcrt.h
Ignoring path /Volumes/Development/Repositories/objc4/runtime/runtime.h
mv: /Volumes/Development/Repositories/objc4/runtime/.git-rewrite/t/../index.new: No such file or directory
index filter failed: git ls-files -s | sed "s/ / \/Volumes\/Development\/Repositories\/objc4\/runtime\//" | GIT_INDEX_FILE=${GIT_INDEX_FILE}.new git update-index --index-info && mv ${GIT_INDEX_FILE}.new ${GIT_INDEX_FILE}
第三次脚本运行尝试:
Bryces-HD-1-TB:runtime bryce$ /Users/bryce/Downloads/git-rewrite-to-subfolder
This script rewrites your entire history, moving the current repository root into a subdirectory. This can be useful if you want to merge a submodule into its parent repository.
For example, your main repository might contain a submodule at the path src/lib/, containing a file called "test.c". If you would merge the submodule into the parent repository without further modification, all the commits to "test.c" will have the path "/test.c", whereas the file now actually lives in "src/lib/test.c".
If you rewrite your history using this script, adding "src/lib/" to the path and the merging into the parent repository, all paths will be correct.
NOTE: This script might complete garble your repository, so PLEASE apply this only to a clone of the repository where it does not matter if the repo is destroyed.
Do you want to proceed? (y/n) y
Please provide the path which should be prepended to the current root. In the above example, that would be "src/lib". Please note that the path MUST NOT contain a trailing slash.
Please provide the desired path (e.g. 'src/lib'): /Volumes/Development/Repositories/objc4/runtime
100644 f14f44cb3b69631fac2463fad25cd3b40b4dbc5b 0 /Volumes/Development/Repositories/objc4/runtime/.gitignore
100644 5342bd2b09a64ea93e3587d5d3e9d97966871555 0 /Volumes/Development/Repositories/objc4/runtime/Accessors.subproj:/objc-accessors.h
100644 d1e5617d8b3ed55f1d32e65f8af75c3ab914dc26 0 /Volumes/Development/Repositories/objc4/runtime/Accessors.subproj:/objc-accessors.m
100644 4b4584b9e7bd196fb0c1906b3ebcb37af52eac31 0 /Volumes/Development/Repositories/objc4/runtime/Auto.subproj/objc-auto-i386.s
100644 c3f7332252a2b17f5d6a7e06bbd370f68909ce9f 0 /Volumes/Development/Repositories/objc4/runtime/Auto.subproj/objc-auto-ppc.s
⋮
100644 b48f5e3581a430edc7984d7a72f6044d2618746c 0 /Volumes/Development/Repositories/objc4/runtime/objc.h
100644 af2830174561fa3a8d4a19996190992a8fa0f850 0 /Volumes/Development/Repositories/objc4/runtime/objcrt.c
100644 b3995456f9ee5860970abf496f2a2de591bfb4d9 0 /Volumes/Development/Repositories/objc4/runtime/objcrt.h
100644 c6047bbdb38ed2cd9d2bb7fee2d653d063874070 0 /Volumes/Development/Repositories/objc4/runtime/runtime.h
Please take a look at the printed file list. Does it look correct? (y/n) y
Rewrite 50d5519c12723f5d9ec2170bc45c144b25a8107e (1/5)Ignoring path /Volumes/Development/Repositories/objc4/runtime/Accessors.subproj:/objc-accessors.h
Ignoring path /Volumes/Development/Repositories/objc4/runtime/Accessors.subproj:/objc-accessors.m
Ignoring path /Volumes/Development/Repositories/objc4/runtime/Auto.subproj/objc-auto-i386.s
Ignoring path /Volumes/Development/Repositories/objc4/runtime/Auto.subproj/objc-auto-ppc.s
⋮
Ignoring path /Volumes/Development/Repositories/objc4/runtime/objc.h
Ignoring path /Volumes/Development/Repositories/objc4/runtime/objcrt.c
Ignoring path /Volumes/Development/Repositories/objc4/runtime/objcrt.h
Ignoring path /Volumes/Development/Repositories/objc4/runtime/runtime.h
mv: /Volumes/Development/Repositories/objc4/runtime/.git-rewrite/t/../index.new: No such file or directory
index filter failed: git ls-files -s | sed "s/ / \/Volumes\/Development\/Repositories\/objc4\/runtime\//" | GIT_INDEX_FILE=${GIT_INDEX_FILE}.new git update-index --index-info && mv ${GIT_INDEX_FILE}.new ${GIT_INDEX_FILE}
P。 S.:
即使我按照您在回答中给我的说明进行操作,我又遇到了麻烦。在这里,连同我的输入,是您的脚本在提示和错误消息方面向我吐出的内容:
Bryces-HD-1-TB:objc4 bryce$ /Users/bryce/Downloads/git-rewrite-to-subfolder
This script rewrites your entire history, moving the current repository root into a subdirectory. This can be useful if you want to merge a submodule into its parent repository.
For example, your main repository might contain a submodule at the path src/lib/, containing a file called "test.c".
If you would merge the submodule into the parent repository without further modification, all the commits to "test.c" will have the path "/test.c", whereas the file now actually lives in "src/lib/test.c".
If you rewrite your history using this script, adding "src/lib/" to the path and the merging into the parent repository, all paths will be correct.
NOTE: This script might complete garble your repository, so PLEASE apply this only to a clone of the repository where it does not matter if the repo is destroyed.
Do you want to proceed? (y/n) y
Please provide the path which should be prepended to the current root. In the above example, that would be "src/lib". Please note that the path MUST NOT contain a trailing slash.
Please provide the desired path (e.g. 'src/lib'): runtime
100644 7fe9c0cee579b7b5ccce3f903486557c01f58255 0 runtime/.gitmodules
160000 9569632f173948b503fa3e23187fbd3dbe124eb0 0 runtime/runtime
Please take a look at the printed file list. Does it look correct? (y/n) y
Rewrite 5119d79f8b4714e17fb23ea84fa7801ca71b896c (2/5)mv: /Volumes/Development/Repositories/objc4/.git-rewrite/t/../index.new: No such file or directory
index filter failed: git ls-files -s | sed "s/ / runtime\//" | GIT_INDEX_FILE=${GIT_INDEX_FILE}.new git update-index --index-info && mv ${GIT_INDEX_FILE}.new ${GIT_INDEX_FILE}
【问题讨论】:
标签: git terminal git-submodules osx-yosemite darwin