2012-04-23 17 views

答えて

3

人跡未踏ファイルがを更新することはできません。彼らは最初に追跡されません。
あなたはを追加する必要があります。追加されていないファイル。最も一般的にあなたが使用したいことを行うには:

$ git add some_untracked_file 
$ # or 
$ git add . # add all files 
$ # or 
$ git add --all # similar to -A , add all again 

すべてすべてのファイルをそこに意味doesntのが、.gitignoreファイル内のエントリと一致しないすべてのファイル。 manページから

-u, --update 
     Only match <filepattern> against already tracked files in the index rather than the working tree. That means that it will never stage 
     new files, but that it will stage modified new contents of tracked files and that it will remove files from the index if the 
     corresponding files in the working tree have been removed. 

     If no <filepattern> is given, default to "."; in other words, update all tracked files in the current directory and its 
     subdirectories. 

    -A, --all 
     Like -u, but match <filepattern> against files in the working tree in addition to the index. That means that it will find new files as 
     well as staging modified content and removing files that are no longer in the working tree. 
+0

$ gitのを追加します。 - 追跡されていないファイルを追加しません。 – sunprophit

+1

私が 'git add .'と' git add -A'は両方とも '.gitignore'ファイルのエントリと一致しない_untracked_ファイルをすべて追加します。これを簡単にテストすることができます: 'mkdir test; CDテスト; a b cをタッチする。 git init; git add a; git commit -m "add a"; echo "b"> .gitignore; git add .gitignore; git commit -m "add ignore"; git add。 git commit -m "add c"; '_b_は無視され、' git add .'または 'git add -A'によって追加されません。これは_.gitignore_のエントリと一致するためです。 – c00kiemon5ter

2

はgitのマニュアルを参照してください。

-u、--update はインデックスのみではなく、彼の作業ツリーの中ファイルを追跡し、既に照合します。つまり、 新しいファイルをステージングすることはできませんが、 追跡ファイルの変更された新しい内容がステージングされ、作業ツリーの対応するファイルが削除されている場合は、インデックスからファイルが削除されます。