Git始终从我的存储库中删除2个目录,我如何解决这个问题?

我不指望有人解决我的问题,但我不太清楚如何解决这个问题。 如果我做了“git status”,我会得到:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    app/controllers/application.rb
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
#       modified:   app/views/main/index.html.erb
#       modified:   public/stylesheets/bandop.css
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       vendor/plugins/contacts/.gitignore
#       vendor/plugins/contacts/.gitmodules

但如果我做“git add”。 然后“git status”,我得到:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    app/controllers/application.rb
#       modified:   app/views/main/index.html.erb
#       modified:   public/stylesheets/bandop.css
#       new file:   vendor/plugins/blackbook
#       deleted:    vendor/plugins/blackbook/CHANGES.markdown
#       deleted:    vendor/plugins/blackbook/Manifest.txt
#       deleted:    vendor/plugins/blackbook/README.markdown
#       deleted:    vendor/plugins/blackbook/Rakefile
#       deleted:    vendor/plugins/blackbook/blackbook.gemspec
#       deleted:    vendor/plugins/blackbook/debug_blackbook.rb
#       deleted:    vendor/plugins/blackbook/init.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/exporter/base.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/exporter/vcf.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/exporter/xml.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/aol.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/base.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/csv.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/freenet.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/gmail.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/gmx.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/hotmail.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/page_scraper.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/web.de.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/yahoo.rb
#       deleted:    vendor/plugins/blackbook/test/fixtures/aol_new_contacts.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail.csv
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_bad_login_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_contacts.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_login_response_stage_1.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_login_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_login_response_stage_2a.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_login_response_stage_3.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_redirect_body.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_bad_login_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_contacts.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_login_response_stage_1.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_login_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_login_response_stage_3.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_scrape_first_page.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_scrape_response_stage_1.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_scrape_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_scrape_response_stage_3.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_bad_login_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_contacts.csv
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_contacts_not_logged_in.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_contacts_stage_1.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_login_response_stage_1.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_login_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_no_user_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/freenet_importer_test.rb
#       deleted:    vendor/plugins/blackbook/test/gmx_importer_test.rb
#       deleted:    vendor/plugins/blackbook/test/scripts/live_test.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_exporter_base.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_exporter_vcf.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_exporter_xml.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_aol.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_base.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_csv.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_gmail.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_hotmail.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_page_scraper.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_yahoo.rb
#       deleted:    vendor/plugins/blackbook/test/test_helper.rb
#       deleted:    vendor/plugins/blackbook/test/web.de_importer_test.rb
#       deleted:    vendor/plugins/blackbook/vendor/plugins/blackbook/lib/autotest/blackbook.rb
#       deleted:    vendor/plugins/blackbook/vendor/plugins/blackbook/lib/autotest/discover.rb
#       new file:   vendor/plugins/contacts
#       deleted:    vendor/plugins/contacts/MIT-LICENSE
#       deleted:    vendor/plugins/contacts/README.rdoc
#       deleted:    vendor/plugins/contacts/Rakefile
#       deleted:    vendor/plugins/contacts/lib/config/contacts.yml
#       deleted:    vendor/plugins/contacts/lib/contacts.rb
#       deleted:    vendor/plugins/contacts/lib/contacts/flickr.rb
#       deleted:    vendor/plugins/contacts/lib/contacts/google.rb
#       deleted:    vendor/plugins/contacts/lib/contacts/version.rb
#       deleted:    vendor/plugins/contacts/lib/contacts/windows_live.rb
#       deleted:    vendor/plugins/contacts/lib/contacts/yahoo.rb
#       deleted:    vendor/plugins/contacts/spec/contact_spec.rb
#       deleted:    vendor/plugins/contacts/spec/feeds/contacts.yml
#       deleted:    vendor/plugins/contacts/spec/feeds/flickr/auth.getFrob.xml
#       deleted:    vendor/plugins/contacts/spec/feeds/flickr/auth.getToken.xml
#       deleted:    vendor/plugins/contacts/spec/feeds/google-many.xml
#       deleted:    vendor/plugins/contacts/spec/feeds/google-single.xml
#       deleted:    vendor/plugins/contacts/spec/feeds/wl_contacts.xml
#       deleted:    vendor/plugins/contacts/spec/feeds/yh_contacts.txt
#       deleted:    vendor/plugins/contacts/spec/feeds/yh_credential.xml
#       deleted:    vendor/plugins/contacts/spec/flickr/auth_spec.rb
#       deleted:    vendor/plugins/contacts/spec/gmail/auth_spec.rb
#       deleted:    vendor/plugins/contacts/spec/gmail/fetching_spec.rb
#       deleted:    vendor/plugins/contacts/spec/rcov.opts
#       deleted:    vendor/plugins/contacts/spec/spec.opts
#       deleted:    vendor/plugins/contacts/spec/spec_helper.rb
#       deleted:    vendor/plugins/contacts/spec/windows_live/windows_live_spec.rb
#       deleted:    vendor/plugins/contacts/spec/yahoo/yahoo_spec.rb
#       deleted:    vendor/plugins/contacts/vendor/windowslivelogin.rb

问题是我从来没有删除任何这些文件,git只是认为我做到了。 我的解决方法是在我提交之前每次执行“git add vendor / plugins / contacts /”和“git add vendor / plugins / blackbook /”,但这很糟糕。 任何人都可以提供方向吗?

更新:

感谢评论,我发现了大部分问题。 即使它们是源代码控制的,我也从未将插件视为子模块。

到目前为止,我已经从blackbook插件中删除了SCM(我实际上并不需要或不需要它)。 我完全删除了联系人,并做到了:

git submodule add repo_address local_address
git submodule init
git submodule update
git add vendor/plugins/contacts
git add .
git commit -m "submodule should be committing now"

但现在的问题是,虽然联系人插件代码存在于我的本地仓库中。 我无法让它承诺我的远程回购。 即使在“git add”之后。 或更明确地“git添加供应商/插件/联系人”....任何想法在这里?

谢谢!


奇怪的。 你有一个博客条目报告完全相同的问题。 使用子模块,如Dave的答案中所述。

这只能通过删除“restful_authentication”目录上的版本控制来解决:

.~/projects/bushi2do master $ rm -rf vendor/plugins/restful_authentication/.git
.~/projects/bushi2do master $ git add .
.~/projects/bushi2do master $ git status
# On branch master
nothing to commit (working directory clean)

这个修复的缺点是你不能再在插件的目录上“乱拉”来获取更新。


怎么样

git rm --cached vendor/plugins/contacts
git rm --cached vendor/plugins/blackbook

你是如何在你的plugins目录中声明你的子模块的?

因为我记得经典的子模块。
如果你使用git子模块,如果foo是你的子模块,不要做git add foo/ (注意斜线!)。 它变得混乱。

从这里:

在子模块上使用git add时,请确保没有尾部斜线。

> git add local/path
  -- adds the submodule

> git add local/path/
  -- adds all the files in the submodule directly into your repository, big no-no

无法确定地告诉你,但我会考虑问题是否与指定为git子模块的“blackbook”和“contacts”插件相关。

链接地址: http://www.djcxy.com/p/92357.html

上一篇: Git is consistently deleting 2 directories from my repository, how can I troubleshoot this?

下一篇: How to dim background when using the BottomSheet from the support library?