1

I have a folder dotfiles where I keep my configuration files like .vimrc. Now in my current version on the master there is an empty folder dotfiles/.vim/bundle/vim-colors-solarized/ I wanted to add files to this folder (so that the solarized color scheme actually works), so I went to the bundle directory and cloned the solarized github project

$ cd dotfiles/.vim/bundle
$ git clone git://github.com/altercation/vim-colors-solarized.git

Now, the folder bundle/vim-colors-solarized is actually filled with files. Weirdly, when I go back to the dotfiles folder and ask for git status it says that everything is up to date with the master branch and that there is nothing to commit.

Is this because I cloned a git project in stead of actually copying those files?

sjbuysse
  • 3,872
  • 7
  • 25
  • 37
  • If `git status` doesn't throw an error when run in `dotfiles/`, it means that you have (at least) one Git repository (`vim-colors-solarized`) nested inside another (`dotfiles`?). In that case, running `git status` outside the root folder of the nested Git repo will not tell you anything about modified files in that repo. – jub0bs Jun 30 '15 at 12:09
  • @Jubobs - does git automatically ignore nested repos or something? I would have guessed that it would show the nested .git directory (along with everything else) as something to add. – David Deutsch Jun 30 '15 at 12:13
  • @DavidDeutsch See VonC's answer. – jub0bs Jun 30 '15 at 12:13

2 Answers2

2

Is this because I cloned a git project in stead of actually copying those files?

Yes, a git status won't show the status of a nested git repo.

If you want to actually commit a reference to github.com/altercation/vim-colors-solarized.git, you need to add it as a submodule with git submodule add.

git submodule add -- https://github.com/altercation/vim-colors-solarized.git dotfiles/.vim/bundle/vim-colors-solarized 

Once added and initialized (git submodule update --init), you will add and commit the gitlink (special entry in the index) of the SHA1 of the subrepo you have checked out.

Note that by default, git status only mention the global state ("dirty" or "new commits" or ...) of a submodule, not the exact modified files within said submodule repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Check whether .vim/ directory is listed in .gitignore file in dotfiles/ directory.

xxxxx
  • 1,918
  • 2
  • 17
  • 22
  • That would be a good tip in general, but not in this case, where there is a Git repo nested inside another. – jub0bs Jun 30 '15 at 13:41