问题描述
我在我的git respository中添加了一个新的子目录:
I added a new subdir within my git respository:
git add feeds
然后提交这个并将其推送到GitHub,但似乎我已经提交了一个符号链接/快捷方式,但不是其中的实际目录和文件。
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.
参见这里:
任何想法'feed'是什么?
Any idea what 'feeds' is?
我'我想删除它,并正确添加我的文件。我试过以下,但 git状态
表示没有改变:
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
要删除Feed,请运行?
To remove feeds do I run the following?
git filter-branch --tree-filter 'rm -f feeds' HEAD
更新
感谢Wes。
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从我的回购中删除此子模块(当我查看 git status
时,它仍然被跟踪)
git filter-branch
didn't remove this submodule from my repo (it was still tracked when I viewed git status
)
要删除此错误我(其中我试图添加Feed类)。
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()
使用命令:
git rebase -i HEAD~3
然后我删除了提交2& 3,离开顶行(我的承诺在4月2日),保存我的更改(:wq)并强制推送到GitHub。
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
现在我的GitHub repo回到我之前添加的Feed。
Now my GitHub repo is back to where I was before adding feeds.
我最初的错误是忘记在最初添加Feed时使用斜杠。我应该使用
My original mistake was forgetting to use a slash at the end when adding feeds initially. I should have used
git add feeds/
推荐答案
看起来您将 feeds
添加为子模块。查看提交:
Looks like you added feeds
as a submodule. Check out the commit:http://github.com/G4EGK/RSS-Reader/commit/276b2392acd2abbd1fadb310768796675d287771
检查 git子模块状态
这篇关于我的GitHub目录发生了什么事?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!