1

コマンドgit add -u .git を使用しても、追跡されていないファイルは更新されません。
パスで指定した場合にのみ機能しますが、それはgit add -- filepath
何でしょうか?

4

2 に答える 2

3

追跡されていないファイルは更新できません。そもそも追跡されていません。追跡されていないファイルを追加
する必要があります。これを行うには、最も一般的に使用します。

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

すべてがすべてのファイルを意味するわけではありませんが、.gitignoreファイルのエントリと一致しないすべてのファイルを意味します。

マニュアルページから:

  -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.
于 2012-04-23T14:00:45.593 に答える
2

gitマニュアルを参照してください:

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

于 2012-04-23T14:00:22.587 に答える