문제

When I use command git add -u . git still doesn't update untracked files.
Works only when I specify them by path, git add -- filepath
What could it be?

도움이 되었습니까?

해결책

untracked files cannot be updated. they are not tracked in the first place.
you need to add untracked files. to do that most commonly you'd use:

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

all there doesnt mean every file, but every file that doesn't match an entry in the .gitignore file.

from the man page:

  -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.

다른 팁

See git manual:

-u, --update Only match against already tracked files in the index rather than he 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top