天天看點

我如何進行‘git status‘,以便在不使用.gitignore的情況下不顯示未跟蹤的檔案?

本文翻譯自:How do I do a 'git status' so it doesn't display untracked files without using .gitignore?

How do I do a

git status

so it doesn't display untracked files without using

.gitignore

?

如何做一個

git status

,是以不會不使用顯示未跟蹤檔案

.gitignore

I want to get modification status information on tracked files only.

我想僅擷取有關跟蹤檔案的修改狀态資訊。

#1樓

參考:https://stackoom.com/question/2Uir/我如何進行-git-status-以便在不使用-gitignore的情況下不顯示未跟蹤的檔案

#2樓

Note that, since git 1.8.3 (April, 22d 2013) , you will know about the

--untracked-files=no

even if you didn't add that option in the first place!

請注意,從git 1.8.3(2013年4月22日)開始 ,即使你沒有首先添加該選項,你也會知道

--untracked-files=no

"

git status

" suggests users to look into using

--untracked-files=no

option when it takes too long.

git status

”建議使用者在花費太長時間時使用

--untracked-files=no

選項。

See commit https://github.com/git/git/commit/5823eb2b28696bf0eb25f6ca35b303447869f85 :

請參閱送出https://github.com/git/git/commit/5823eb2b28696bf0eb25f6ca35b303447869f85 :
In some repositories users experience that "

git status

" command takes long time. 在某些存儲庫中,使用者會體驗到“

git status

”指令需要很長時間。
The command spends some time searching the file system for untracked files. 該指令花費一些時間在檔案系統中搜尋未跟蹤的檔案。 Explain the trade-off struck by the default choice of

normal

to help users make an appropriate choice better, before talking about the configuration variable. 在讨論配置變量之前,解釋預設選擇

normal

以達到的權衡,以幫助使用者更好地做出适當的選擇。

The

git status

documentation now states:

git status

文檔現在聲明:
When

-u

option is not used, untracked files and directories are shown (ie the same as specifying

normal

), to help you avoid forgetting to add newly created files. 如果未使用

-u

選項,則會顯示未跟蹤的檔案和目錄(即與指定

normal

檔案相同),以幫助您避免忘記添加新建立的檔案。
Because it takes extra work to find untracked files in the filesystem, this mode may take some time in a large working tree. 由于在檔案系統中查找未跟蹤檔案需要額外的工作,是以在大型工作樹中此模式可能需要一些時間。 You can use

no

to have

git status

return more quickly without showing untracked files . 您可以使用

no

來更快地傳回

git status

而不顯示未跟蹤的檔案 。
The default can be changed using the

status.showUntrackedFiles

configuration variable documented in

git config

. 可以使用

git config

記錄的

status.showUntrackedFiles

配置變量來更改預設值。

#3樓

Use this:

用這個:
git status -uno
           

which is equivalent to:

這相當于:
git status --untracked-files=no
           

It's a bit hidden in the manuals, but the manpage for status says "supports the same options as git-commit", so that's where you'd have to look.

它在手冊中有點隐藏,但狀态的聯機幫助頁顯示“支援與git-commit相同的選項”,是以這是您必須檢視的位置。

#4樓

也:

git config status.showuntrackedfiles no