初始输出:
ravi@boxy ~/.dotfiles/.vim/bundle $ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
ravi@boxy ~/.dotfiles/.vim/bundle $
现在再次cd并运行git status:
ravi@boxy ~/.dotfiles/.vim/bundle $ cd neobundle.vim/
ravi@boxy ~/.dotfiles/.vim/bundle/neobundle.vim $ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
modified: .travis.yml
modified: LICENSE-MIT.txt
modified: Makefile
modified: README.md
modified: autoload/neobundle.vim
modified: autoload/neobundle/TOML.vim
modified: autoload/neobundle/autoload.vim
modified: autoload/neobundle/cache.vim
modified: autoload/neobundle/commands.vim
modified: autoload/neobundle/config.vim
modified: autoload/neobundle/init.vim
modified: autoload/neobundle/installer.vim
modified: autoload/neobundle/parser.vim
modified: autoload/neobundle/sources/github.vim
modified: autoload/neobundle/sources/neobundle_vim_recipes.vim
modified: autoload/neobundle/types/git.vim
modified: autoload/neobundle/types/hg.vim
modified: autoload/neobundle/types/nosync.vim
modified: autoload/neobundle/types/raw.vim
modified: autoload/neobundle/types/svn.vim
modified: autoload/neobundle/types/vba.vim
modified: autoload/neobundle/util.vim
modified: autoload/neobundle/vamkr.vim
modified: autoload/unite/kinds/neobundle.vim
modified: autoload/unite/sources/neobundle.vim
modified: autoload/unite/sources/neobundle_install.vim
modified: autoload/unite/sources/neobundle_lazy.vim
modified: autoload/unite/sources/neobundle_log.vim
modified: autoload/unite/sources/neobundle_search.vim
modified: bin/install.sh
modified: bin/neoinstall
modified: bin/neoinstall.bat
modified: bin/neoinstall_novimproc.bat
modified: ftdetect/vimrecipe.vim
modified: plugin/neobundle.vim
modified: syntax/vimrecipe.vim
modified: test/commands.vim
modified: test/lock.vim
modified: test/parse.vim
modified: test/recipe.vim
modified: test/sample.vim
modified: test/source.vim
modified: test/toml.vim
modified: test/tsort.vim
no changes added to commit (use "git add" and/or "git commit -a")
ravi@boxy ~/.dotfiles/.vim/bundle/neobundle.vim $
为什么这个较长的列表不包含在父目录的git status
中?
主要.gitignore
:
ravi@boxy ~/.dotfiles $ cat .gitignore
# Don't put a comment after a command!
*~
*.swp
.vim/.netrwhist
.vim/ctrlp-cache/
#
# Include neobundle to bootstrap
#
# entries but not the dir itself
.vim/bundle/*
# include directory only
!.vim/bundle/
!.vim/bundle/neobundle.vim/
ravi@boxy ~/.dotfiles $
子目录.gitignore
ravi@boxy ~/.dotfiles/.vim/bundle/neobundle.vim $ cat .gitignore
doc/tags
ravi@boxy ~/.dotfiles/.vim/bundle/neobundle.vim $
版本:
ravi@boxy ~/.dotfiles $ git --version
git version 2.6.3
ravi@boxy ~/.dotfiles $
答案 0 :(得分:2)
假设您使用的是Vim包管理器,您的存储库中似乎有Git sumodules。
因此,~/.dotfiles/.vim/bundle/neobundle.vim
是另一个Git存储库,它具有自己的状态。通常,您会在父存储库(~/.dotfiles/.vim/bundle
)中看到此子模块已更改,但可能已忽略其所在的目录。此外,不会在父目录的状态中看到这些文件,因为它们归子模块所有,而不是存储库本身。
答案 1 :(得分:0)
/.dotfiles/.vim/bundle/neobundle.vim
是一个存储库,因此其中的任何更改都会从包含的存储库中隐藏。
但是,包含的repo not 作为子模块添加,因此不会被git clone
打倒,因为.dotfiles设置是理想的。< / p>
从子模块中删除以某种方式在父仓库中跟踪的文件:
git rm --cache -r neobundle.vim/
将其添加为子模块
git submodule add https://github.com/Shougo/neobundle.vim .vim/bundle/neobundle.vim/
初始化和更新
git submodule init
git submodule update
git submodule update --recursive
使用git submodule ...
命令完全支持Git Submodules: Adding, Using, Removing, Updating的精彩指南。
感谢Nicolas指出我正确的方向,尤其是提及&#34;子模块&#34;。