Git-Bitbucket存储库尚未将文件存储在子文件夹中 [英] Git - Bitbucket repo hasnt stored the files in a sub-folder

查看:93
本文介绍了Git-Bitbucket存储库尚未将文件存储在子文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于Bitbucket的仓库.我只是注意到,它没有存储我稍后添加的特定子文件夹.

I have a repo on Bitbucket. I just noticed, it has not stored a particular sub-folder I added later.

注意到,我尝试运行以下命令:

Upon noticing, I tried to run the commands:

git add *

(不添加子文件夹)

git add (folder path)

(仍然没有影响)

我的.gitignore为空

My .gitignore is empty

如何将文件添加到存储库中?

How can I add the files to the repo?

在仓库中,我有目录&显示为的文件(即这些文件仅是参考,不可点击):

On the repo, I have the directory & files showing as (i.e. the files are mere references, not clickable):

推荐答案

如果您的存储库中没有.gitmodules文件,则这些不可点击的引用为嵌套git repo ,其 gitlink (索引中的特殊条目)由git repo父级记录.

If your repo does not have a .gitmodules file, then those not-clickable references are nested git repo whose gitlink (special entry in the index) is recorded by the git repo parent.

这允许父级记录这些存储库的SHA1(但无需记录来自那些存储库的 ,而不是子模块,子模块将其原始URL保留在的.gitmodules文件中父仓库).

That allows the parent to record the SHA1 of those repos (but without recording from where those repos are coming from, as opposed to submodules, which keep their origin url in the .gitmodules file of the parent repo).

检查1507-MainApp中是否包含.git/子文件夹:这将是嵌套的存储库.

Check if 1507-MainApp has a .git/ sub-folder in it: that would make is a nested repo.

如果您真的想将该文件夹的内容作为回购的一部分(并丢弃其历史记录),只需执行以下操作:

If you really want to consider the content of that folder as part of your repo (and discard its history), simply do a:

# no trailing slash: you need to remove the gitlink first
git rm --cached 1507-MainApp

rm -Rf 1507-MainApp/.git
git add 1507-MainApp

然后提交并推送.

如果要保留这些子文件夹的历史记录,请然后将它们添加为子模块.

If you want to keep the history of those subfolder, then you would need to add them as submodule.

这篇关于Git-Bitbucket存储库尚未将文件存储在子文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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