简体   繁体   English

从1个文件夹中删除Git Repo并将该文件夹添加到另一个Repo Git

[英]Remove Git Repo From 1 Folder and Add that Folder to Another Repo Git

I am working on a project which has it's own git repo, this one I would like to keep. 我正在开发一个具有自己的git repo的项目,我想保留这个项目。 However I used a library that I cloned from github. 但是我使用了从github克隆的库。 I cloned this into a subfolder of my project. 我将其克隆到项目的子文件夹中。 So the folder structure is correct. 因此文件夹结构是正确的。

What would be the best way to remove the repo from the library and add the library to my own repo? 从库中删除存储库并将库添加到我自己的存储库中的最佳方法是什么? I need to keep the history in my project but not in the library. 我需要将历史记录保留在我的项目中,而不是在图书馆中。

EDIT 编辑

I use Tower to manage git this shows the follow. 我使用Tower管理git,这显示了以下内容。 I guess it being in a submodule is the problem. 我想这是一个子模块中的问题。 How to solve this? 如何解决呢?

在此处输入图片说明

You can just remove the .git folder that came with the library. 您可以仅删除库随附的.git文件夹。 This will loose all the history of the library from GitHub, but that seems to be what you want. 这将丢失GitHub中所有库的历史记录,但这似乎就是您想要的。

Assuming linux/osx: 假设linux / osx:

cd /path/to/library/dir
rm -rf .git/

Once you have removed the GitHub repo, you can add it with just a normal git add: 删除GitHub存储库后,您可以使用普通的git add添加它:

cd /path/to/library/dir
git add .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM