我在 GitHub 上的目录发生了什么?

发布于 2024-08-27 06:12:12 字数 2328 浏览 7 评论 0原文

我在 git 存储库中添加了一个新的子目录:

git add feeds

然后提交了这个并将其推送到 GitHub,但似乎我提交了一个符号链接/快捷方式,但没有提交其中的实际目录和文件。

请参阅此处:http://github.com/G4EGK/RSS-Reader

知道什么'饲料'是?

我想删除它并正确添加我的文件。我尝试了以下操作,但 git status 表示没有任何变化:

git rm feeds
git add feeds/\*.php

要删除提要,我运行 以下内容

git filter-branch --tree-filter 'rm -f feeds' HEAD

更新

谢谢韦斯。

$ ls -l
total 16
-rw-r--r--@  1 greg  staff  890  2 Apr 19:11 README.md
drwxr-xr-x  10 greg  staff  340  3 Apr 09:30 feeds
-rw-r--r--@  1 greg  staff  372  2 Apr 19:24 rssreader.php
drwxr-xr-x   3 greg  staff  102  2 Apr 15:23 tests
drwxr-xr-x   7 greg  staff  238  2 Apr 15:44 transfer
$ git submodule feeds
No submodule mapping found in .gitmodules for path 'feeds'

git filter-branch 没有从我的存储库中删除这个子模块(当我查看 git status 时它仍然被跟踪)

要删除这个错误,我 恢复了最后两次提交(我尝试添加提要类)。

$ git log
commit 276b2392....
Author: Greg K <[email protected]>
Date:   Sat Apr 3 23:40:14 2010 +0100

    Add feed classes

commit d9814942....
Author: Greg K <[email protected]>
Date:   Sat Apr 3 23:37:52 2010 +0100

    Add feed classes

commit 2b7fb93a....
Author: Greg K <[email protected]>
Date:   Fri Apr 2 19:47:09 2010 +0100

    Use auto-detect line length for fgets()

使用命令:

git rebase -i HEAD~3

然后我删除了提交 2 & 3、离开顶行(我在 4 月 2 日提交),保存我的更改 (:wq) 并强制推送到 GitHub。

git push origin +master

现在我的 GitHub 存储库回到了添加 feed 之前的位置。

我最初的错误是在最初添加提要时忘记在末尾使用斜杠。我应该用过

git add feeds/

I added a new subdir within my git respository:

git add feeds

Then commited this and pushed it up to GitHub but it seems as though I've commited a symlink / shortcut but not the actual directory and files within.

See here: http://github.com/G4EGK/RSS-Reader

Any idea what 'feeds' is?

I'd like to remove that and correctly add my files. I tried the following but git status said nothing had changed:

git rm feeds
git add feeds/\*.php

To remove feeds do I run the following?

git filter-branch --tree-filter 'rm -f feeds' HEAD

Update

Thanks Wes.

$ ls -l
total 16
-rw-r--r--@  1 greg  staff  890  2 Apr 19:11 README.md
drwxr-xr-x  10 greg  staff  340  3 Apr 09:30 feeds
-rw-r--r--@  1 greg  staff  372  2 Apr 19:24 rssreader.php
drwxr-xr-x   3 greg  staff  102  2 Apr 15:23 tests
drwxr-xr-x   7 greg  staff  238  2 Apr 15:44 transfer
$ git submodule feeds
No submodule mapping found in .gitmodules for path 'feeds'

git filter-branch didn't remove this submodule from my repo (it was still tracked when I viewed git status)

To remove this mistake I reverted the last two commits (where I tried to add feed classes).

$ git log
commit 276b2392....
Author: Greg K <[email protected]>
Date:   Sat Apr 3 23:40:14 2010 +0100

    Add feed classes

commit d9814942....
Author: Greg K <[email protected]>
Date:   Sat Apr 3 23:37:52 2010 +0100

    Add feed classes

commit 2b7fb93a....
Author: Greg K <[email protected]>
Date:   Fri Apr 2 19:47:09 2010 +0100

    Use auto-detect line length for fgets()

Used the command:

git rebase -i HEAD~3

Then I deleted commits 2 & 3, leaving the top line (my commit on April 2nd), saved my changes (:wq) and forced a push to GitHub.

git push origin +master

Now my GitHub repo is back to where I was before adding feeds.

My original mistake was forgetting to use a slash at the end when adding feeds initially. I should have used

git add feeds/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

那小子欠揍 2024-09-03 06:12:12

看起来您添加了 feeds 作为子模块。查看提交:
http://github.com/G4EGK/RSS-Reader/commit/276b2392acd2abbd1fadb310768796675d2877 71

检查git子模块状态

Looks like you added feeds as a submodule. Check out the commit:
http://github.com/G4EGK/RSS-Reader/commit/276b2392acd2abbd1fadb310768796675d287771

Check git submodule status

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文