Является ли `git ls-files --others --exclude-standard` равным слиянию` git ls-files --others` и `git ls-files --exclude-standard`? - PullRequest
0 голосов
/ 09 апреля 2020
[root@localhost www]# git --version
git version 1.8.3.1
[root@localhost www]# git ls-files  --exclude-standard
app/third_party/jqgrid/css/ellipsis-xbl.xml
app/third_party/jqgrid/css/ui.jqgrid.css
app/third_party/jqgrid/js/Changes.txt
[root@localhost www]# git ls-files --others 
info/folder/2016-10-08/69.html
info/folder/2016-10-08/70.html
[root@localhost www]# git ls-files --others --exclude-standard
[root@localhost www]# 

Затем я проверяю статус, как показано ниже:

[root@localhost www]# git status
# On branch develop
# Your branch is ahead of 'origin/develop' by 2 commits.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean

Система имеет рабочий стол centos 7.6.
Давайте посмотрим на вывод git выше.
У меня есть кое-что в git ls-files --exclude-standard, и что-то в git ls-files --others.
Тогда, я думаю, git ls-files --others --exclude-standard выведет все файлы, которые не были отслежены, но вывод ничего.
В чем дело?

1 Ответ

2 голосов
/ 09 апреля 2020

Основной набор подкоманд для git ls-files: --[cached|deleted|others|ignored|stage|unmerged|killed|modified]; по умолчанию --cached. --exclude-standard - это не отдельная подкоманда, а фильтр для одной из этих подкоманд.

git ls-files --exclude-standard

эквивалентен

git ls-files --cached --exclude-standard

, т. Е. Показывает все ваши кэшированные файлы из индекса. --exclude-standard здесь просто не применяется.

git ls-files --others --exclude-standard

перечисляет неотслеживаемые и не игнорируемые файлы: фильтр --exclude-standard применяется к --others, то есть неотслеживаемым файлам.

Как показывает git status, вы не отслеживали и не игнорировали файлы, поэтому вывод команды пуст.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...