我有一个~/.janus/带有一堆子模块的git repo .我想添加一个子模块~/.janus/snipmate-snippets/snippets/,但是当我git submodule add <git@github.com:...>在snipmate-snippets目录中运行时,我收到以下错误消息:
You need to run this command from the toplevel of the working tree.
Run Code Online (Sandbox Code Playgroud)
所以问题是:如何在snipmate-snippets目录中添加子模块?
是否有可能只在Git和Mercurial中克隆一个分支(或来自给定的提交)?我的意思是,我想要克隆一个中央回购,但由于它很庞大,我只想获得它的一部分,并且仍能够回馈我的变化.可能吗?比如,我只想从Tag 130开始或类似的东西?
如果是这样,怎么样?
我正在尝试从外部github仓库获取一个文件夹,以便在我的项目中使用.
我希望我的项目设置如下:
-my_project
-submodule
-code.py
-MY_README
-.git
Run Code Online (Sandbox Code Playgroud)
我有一个名为some-submodule的远程repo,结构如下:
-submodule
-code.py
-README
-.gitignore
Run Code Online (Sandbox Code Playgroud)
所以我只想将子模块文件夹添加到我的项目中.
但是之后我最终得到了这个
git submodule add http://github.com/user/submodule.git submodule
-my_project
-submodule
-submodule
-code.py
-README
-.gitignore
-MY_README
-.gitignore
Run Code Online (Sandbox Code Playgroud)
我是git的新手所以我真的不知道是否可以使用git.如果它有一些帮助我在Windows上使用msysgit.
那么,无论如何我可以从公共仓库中获得一个干净的子模块文件夹吗?
假设我的git存储库具有以下结构:
/.git
/Project
/Project/SubProject-0
/Project/SubProject-1
/Project/SubProject-2
Run Code Online (Sandbox Code Playgroud)
并且存储库有一些提交.现在其中一个子项目(SubProject-0)变得非常大,我想将SubProject-0取出并将其设置为独立项目.是否可以从父git存储库中提取涉及SubProject-0的所有提交历史记录并将其移动到新的?
我目前的文件结构如下所示:
# C:\Repositories\VisualStudio\MyProject
.git # repository is one level above clientapp and includes other folders/paths than clientapp
afolder
clientapp
file1
file2
Run Code Online (Sandbox Code Playgroud)
现在我想将该clientapp文件夹移动到新位置并将其重命名为frontend. 然后我想仅为frontend. 直到这里才出现问题:
# inside C:\Repositories\MyProject\frontend (no more VisualStudio in the path!)
.git
<all the frontend folders and files>
Run Code Online (Sandbox Code Playgroud)
现在问题来了:当然,我现在丢失了原始clientapp(现在frontend:)文件夹的历史记录,因为我创建了一个新的存储库。有什么方法可以将有关原始文件夹的提交复制clientapp到我的新存储库吗frontend?