我尝试使用“git add *”、“git commit -m“something”和“git push”向我的github添加一个新文件夹。
这是我的 GitHub 存储库的屏幕截图,我在其中添加了“ angular2-webpack-starter”,但它甚至不是文件夹。
我再次尝试执行上面的命令,它显示
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
Run Code Online (Sandbox Code Playgroud)
那个文件 ( angular2-webpack-starter) 图标是什么意思?
如何将该文件夹添加到我的 GitHub 存储库?
该图标的意思是:嵌套的 git 存储库。
含义:当您执行 a 时git add *,您添加了嵌套 git repo 的顶级文件夹angular2-webpack-starter,将其记录为gitlink(父 repo 中的特殊条目,作为代表嵌套 repo 树的 SHA1)
如果你真的想包含angular2-webpack-starter.git的内容,你需要在 ``angular2-webpack-starter/.git` 子文件夹中删除,并删除 gitlink,然后再将文件夹添加回:
git rm --cached angular2-webpack-starter # no trailing slash
git add .
git commit -m "record deletion of angular2-webpack-starter gitlink"
rm -Rf angular2-webpack-starter/.git
git add .
git commit -m "record deletion of angular2-webpack-starter"
git push
Run Code Online (Sandbox Code Playgroud)
但是更简洁的解决方案是添加与submodule相同angular2-webpack-starter的内容,这将使其成为灰色文件夹(再次),但这次带有来自所述来源的录音。.gitmodulesangular2-webpack-starter
| 归档时间: |
|
| 查看次数: |
1110 次 |
| 最近记录: |