sjbuysse
sjbuysse

Reputation: 4154

Git doesn't see new files

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?

Upvotes: 1

Views: 550

Answers (2)

VonC
VonC

Reputation: 1330082

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.

Upvotes: 2

xxxxx
xxxxx

Reputation: 1984

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

Upvotes: 0

Related Questions