问题描述
在一个主要的仓库中,还有另外一个仓库(可能是从github下载的),我称之为一个子仓库。我不' t要使用git子模块功能。
子回购可能会被提交并推送到他自己的远程终端。但我想继续在主要的回购工作,忽略该文件夹(子回购)实际上是一个git回购。但我想跟踪主回购的子回购内容(我正在研究结果 我在这次努力中取得了成功,直到我推动主回购承诺,当我注意到sub-repo内容并没有推在一起。使用 使用 是否可以推动子回购repo content together? 我试过了,子回购中的文件可以和main-repo一起推送。以下步骤可以被引用: Note :您可能已经注意到,如果我们使用 Inside a main repo, there is another repo (which might have been downloaded from github, i.e.), I call this a sub-repo. I don't want to use git submodules feature. The sub-repo might be commited and pushed to his own remote eventually. But I would like to carry on work in the main repo, ignoring that folder (sub-repo) actually is a git repo. But I would like to track the sub-repo content from the main-repo (I was studying the consequences here). I was successful in this endeavor until the point where I pushed main-repo commits, when I noticed the sub-repo content wasn't pushed together. Even though I added it when committing. Using Using Is it possible to push the sub-repo content together? I tried and files in sub-repo can be pushed together with main-repo. The following steps can be refered: Note: You may have noticed that the mode is 160000 if we use 这篇关于将子回购内容一起推送(不使用git子模块)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
git ls-files
,我看到了文件夹(sub-repo) )是存在的,但文件没有列出,所以我不确定sub-repo的内容是否可以通过main-repo进行跟踪。
git ls-tree --full-tree -r HEAD
,我看到子回购被称为 commit
,而不是 blob
就像main-repo的其他文件一样。
git clone< URL for sub-repo>
克隆main-repo下的sub-repo
git状态
,你会发现未跟踪的文件夹子回购,然后使用 git add sub-repo /
和 git commit
来跟踪
/ main-repo / sub-repo
中添加一个文件,例如new.txt。目录
git add sub-repo / new.txt
和 git commit
note:它运行在 / main-repo
目录中)
git push
推送到远程main-repo,你也可以在那里找到文件new.txt。您还可以使用 git ls-files
来查找文件
git add sub-repo
和 git commit $ c,模式为160000 $ c>,如果我们使用
git add sub-repo /
和 git commit
,模式为100644。 1600000是Gitlink,它表示您将提交记录为目录条目而不是子目录或文件,有点像子模块。 100644表示常规的不可执行文件。所以你可以把sub-repo作为一个文件夹。git ls-files
, I see the folder (sub-repo) is there, but files aren't listed, so I'm not sure the sub-repo content is acctualy being tracked by main-repo.git ls-tree --full-tree -r HEAD
, I see the sub-repo being called a commit
, instead of a blob
as is the case for other files of the main-repo.git clone <URL for sub-repo>
to clone the sub-repo under main-repogit status
, you will find a untracked folder sub-repo, then use git add sub-repo/
and git commit
to track/main-repo/sub-repo
directorygit add sub-repo/new.txt
and git commit
(note: it’s run in the /main-repo
directory) git push
to push to remote main-repo, and you can find the file new.txt also there. Also you can use git ls-files
to find the filegit add sub-repo
and git commit
, and mode is 100644 if we use git add sub-repo/
and git commit
. 1600000 is Gitlink, it means you record a commit as a directory entry rather than a subdirectory or a file, somewhat like submodules. 100644 means regular non-executable file. So you can treat sub-repo as a folder.