即使我添加了文件,Git也不会添加我的文件

时间:2018-02-19 02:51:57

标签: linux git shell github

以多种不同方式添加文件后,无论我尝试添加哪种方式,文件仍未添加到提交中。这是我的控制台输出,因此您可以更好地理解:

daniel@padamtuts:~/github/dotfiles$ git status
On branch 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/auto-pairs (modified content)
    modified:   .vim/bundle/ctrlp.vim (modified content)
    modified:   .vim/bundle/emmet-vim (modified content)
    modified:   .vim/bundle/nerdtree (modified content)
    <a lot of files>

no changes added to commit (use "git add" and/or "git commit -a")
daniel@padamtuts:~/github/dotfiles$ git add *
daniel@padamtuts:~/github/dotfiles$ git add -A
daniel@padamtuts:~/github/dotfiles$ git commit -m "Vim bundles"
On branch master
Changes not staged for commit:
    modified:   .vim/bundle/auto-pairs (modified content)
    ...
    <same files>

no changes added to commitPdaniel@padamtuts:~/github/dotfiles$ git status
On branch 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/auto-pairs (modified content)
    <same files>

no changes added to commit (use "git add" and/or "git commit -a")
daniel@padamtuts:~/github/dotfiles$ git add *
daniel@padamtuts:~/github/dotfiles$ git add -A
daniel@padamtuts:~/github/dotfiles$ git commit -m "Vim bundles"
On branch master
Changes not staged for commit:
    modified:   .vim/bundle/auto-pairs (modified content)
    <same files>

no changes added to commit

```

1 个答案:

答案 0 :(得分:4)

.开头的文件/目录是“隐藏的”,当您使用glob字符添加时,git将忽略这些文件/目录。如果你想了解更多,你可以阅读这些'dotfiles';通常它们是配置文件(例如用于vim),并且您可能不希望直接与之交互,默认情况下不会出现在文件资源管理器中,也不会出现在ls的输出中等。

出于您的目的,git add .应该可以解决问题。