git:如何列出要添加的新文件? [英] git: how can i list new files to add them after?
本文介绍了git:如何列出要添加的新文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚在本地计算机上克隆了一个存储库.然后,我在文件夹内创建了一个新文件.当我运行'git st'时,新文件不会出现,甚至不会显示为未跟踪的文件.
I have just cloned a repository in my local computer. Then I've created inside the folder a new file. When i run 'git st' the new file does not appear, not even as an untracked file.
如何列出我在项目内部创建的新文件,以在之后添加它们?
How can i list new files I created inside my project, to add them after?
推荐答案
通常,除非,否则您应该看到该文件
Normally, you should see the file unless
- 保存文件的文件夹尚未添加到存储库中(在这种情况下,键入
git status
时您只会看到该文件夹) - 文件包含在保存文件的文件夹中的
.gitignore
中 - 文件包含在
.gitignore
中
- 文件包含在
.git/info/exclude
中
- 该文件包含在全局
.gitignore
文件中(请检查
git config --global core.excludesfile
)
- the folder holding the file is not yet added to the repo (in that case, you'll see only the folder when typing
git status
) - the file is contained in a
.gitignore
present in the folder holding the file - the file is contained in
.gitignore
- the file is contained in
.git/info/exclude
- the file is contained in your global
.gitignore
file (check with
git config --global core.excludesfile
)
要检查您的文件是否被ignore
文件之一忽略,请输入
To check whether your file is ignored by one of the ignore
files, type
git status --ignored
这还将显示被忽略的文件.
This will also show ignored files.
五种情况下的解决方案:
Solutions for the five cases:
- 当尚未对文件夹进行版本控制时,请使用
git add folder_name
进行添加.这会将文件夹及其所有文件(除非它们被忽略)添加到索引中. - 当文件由
.gitignore
过滤时,请修改该文件,以便在键入git status
时显示要添加的文件.
- when the folder is not yet versioned, add it with
git add folder_name
. This will add the folder and all of it's files (unless they are ignored) to the index. - when the file is filtered by a
.gitignore
, modify that file so that your file to be added shows up when typinggit status
.
这篇关于git:如何列出要添加的新文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文