0

I just want to sync my .vim folder in every computer I have. Those are what I have done for that purpose: 1. cp -r ~/.vim ~/GitRepository/ 2. cd ~/GitRepository 3. git add --all 4. commit and push. But when I check my github, those files should be under the /.vim/subdir/sub-subdir are missing. And those sub-subdir became empty. What could make this happen, though I don't have a .gitignore file and suggestion in this link do no help to me.

And when I type git status. These note show up:

─➤  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)
  (commit or discard the untracked or modified content in submodules)

modified:   .vim/bundle/vim-snippets (modified content)
no changes added to commit (use "git add" and/or "git commit -a")

what make this happen?

=============== second edit============= Thank you, guys. "git add -all"actually missed the dot-file I have. But, It don't conquer my problem.

here is what after I type git add .vim/

╰─➤  git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    new file:   .vim/.netrwhist
    new file:   .vim/.vimrc
    new file:   .vim/.ycm_extra_conf.py
    new file:   .vim/.ycm_extra_conf.pyc
    new file:   .vim/bundle/Vundle.vim
    new file:   .vim/bundle/YouCompleteMe
    new file:   .vim/bundle/ctrlp.vim
    new file:   .vim/bundle/molokai
    new file:   .vim/bundle/nerdtree
    new file:   .vim/bundle/tagbar
    new file:   .vim/bundle/ultisnips
    new file:   .vim/bundle/vim-airline
    new file:   .vim/bundle/vim-colorschemes
    new file:   .vim/bundle/vim-fugitive
    new file:   .vim/bundle/vim-json
    new file:   .vim/bundle/vim-snippets
    new file:   .vim/colors/molokai.vim
    new file:   .vim/colors/solarized.vim

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)
  (commit or discard the untracked or modified content in submodules)

    modified:   .vim/bundle/vim-snippets (modified content)

It seams that git do not recognize these as a directories, why?

Community
  • 1
  • 1
Frank Wang
  • 564
  • 3
  • 16
  • if you don't have a .gitignore and don't care about any dummy file, you could try `git add . -f` – ElpieKay May 27 '16 at 03:28
  • Possible duplicate of [How do I convert between big-endian and little-endian values in C++?](http://stackoverflow.com/questions/105252/how-do-i-convert-between-big-endian-and-little-endian-values-in-c) – Frank Wang Mar 15 '17 at 01:40

4 Answers4

2

add --all won't add hidden files or directories (i.e. those starting with a dot). You need to add them explicitly by name (or at least a pattern like .*).

(Off topic, but possibly helpful: I use homesick gem for my dotfile management. It automates many of the things you are doing by hand now.)

Amadan
  • 169,219
  • 18
  • 195
  • 256
  • Thank you for your suggestion about homesick. But it seams more time to learn about. Could you describe more about "explicitly by name"? Should I type git add manually by name? – Frank Wang May 27 '16 at 02:24
  • `git add ~/GitRepository/.vim`, if I understood your directory structure correctly. – Amadan May 27 '16 at 02:30
  • Yes, I do exactly what you say. But the problem is still not solved. I edited the Q&A again, it shows the no deference except some dot files under the ~/GitRepository. – Frank Wang May 27 '16 at 02:38
1

If you want to add a directory and all the files located inside it recursively, you must specify the directory name in the add command.

$ git add directoryname
Gerardo Figueroa
  • 450
  • 1
  • 6
  • 16
  • No, this is incorrect. Directories can be added using `add --all` without naming them explicitly; *hidden* directories can't. – Amadan May 27 '16 at 02:08
1

The best way you can use is :

 git add *

or

 git add <directory name>
Spyder
  • 724
  • 1
  • 11
  • 17
0

Finally, I find the reason why. I used vundle to manage my vim and .vim/ folder. So, it seams that vundle used the service of git in every "subdir", and with the .gitignore in every "subdir", it actually ignore these things in "subdir".

Frank Wang
  • 564
  • 3
  • 16