Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
587 views
in Technique[技术] by (71.8m points)

git - 问:Git:未跟踪的文件(Q: Git: untracked files)

在此处输入图片说明

~ master ?49 ? git status
> warning: could not open directory '.Trash/': Operation not permitted
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)

~ master ?49 ?
> nothing added to commit but untracked files present (use "git add" to track)

What does ?49 means?

(?49是什么意思?)

Does it have to do something with git?

(它与git有关系吗?)

Also, when I enter git status it lists all my files and give me this:

(另外,当我输入git status它会列出我的所有文件并给我以下信息:)

> nothing added to commit but untracked files present (use "git add" to track) 
  ask by maievS translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

?49 in your prompt means there are 49 untracked files in the current Git repository.

(?49你迅捷的方式有在当前Git仓库49个未跟踪文件。)

From the Powerlevel10k FAQ :

(从Powerlevel10k常见问题解答中 :)

Q: Why do I have a question mark symbol in my prompt?

(问:为什么提示中有问号符号?)

A: It means you have untracked files in the current Git repository.

(答:这意味着您在当前的Git存储库中有未跟踪的文件。)

Type git status to see these files.

(输入git status以查看这些文件。)

You can change this symbol or disable the display of untracked files altogether.

(您可以更改此符号或完全禁用未跟踪文件的显示。)

Search for "untracked files" in ~/.p10k.zsh .

(在~/.p10k.zsh搜索“未跟踪的文件”。)

If you've created a Git repository at the root of your home directory to store dotfiles, you probably want to ignore untracked files in it.

(如果您在主目录的根目录下创建了一个Git存储库来存储点文件,则可能要忽略其中未跟踪的文件。)

You can achieve this by executing the following command:

(您可以通过执行以下命令来实现:)

git -C ~ config status.showuntrackedfiles no

This will have several effects:

(这将产生几种效果:)

  • The warning about permissions on .Trash will disappear.

    (有关.Trash权限的警告将消失。)

  • git status will be faster.

    (git status会更快。)

  • git status won't list 49 untracked files.

    (git status不会列出49个未跟踪的文件。)

  • ?49 will disappear from your prompt.

    (?49将从您的提示中消失。)

You can undo the above command with the following command:

(您可以使用以下命令撤消上述命令:)

git -C ~ config --unset status.showuntrackedfiles

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...