git 显示文件状态
The git status
command is used to display the state of the current working directory and staging area. git status
command will list staged changes, current changes. It will not list any history related information.
git status
命令用于显示当前工作目录和暂存区的状态。 git status
命令将列出暂存的更改,当前更改。 它不会列出任何历史记录相关信息。
列出跟踪和未跟踪的文件 (List Tracked and Untracked Files)
We will start with a simple git status
usage. We do not provide any option. This will list tracked and untracked files in a git repository.
我们将从简单的git status
用法开始。 我们不提供任何选择。 这将在git存储库中列出已跟踪和未跟踪的文件。
$ git status
We can see that files named extension.c, pass.c, and pass2.c are not tracked by the git repository. All other files are tracked and their names are not listed.
我们可以看到git存储库未跟踪名为extension.c , pass.c和pass2.c的文件。 跟踪所有其他文件,并且未列出其名称。
以短格式显示 (Show In Short Format)
If we want to just list the tracked and untracked files and folders in a short form we can use -s
. As we can see below only the file and folder and status will be listed. ??
means untracked.
如果我们只想以简短形式列出已跟踪和未跟踪的文件和文件夹,则可以使用-s
。 正如我们在下面看到的,仅列出文件,文件夹和状态。 ??
表示未跟踪。
$ git status -s
From the output, we can see that only untracked file names are listed.
从输出中,我们可以看到仅列出了未跟踪的文件名。
显示分支状态 (Show Branch Status)
If we want to print also the branch status we can provide -b
option like below.
如果我们还要打印分支状态,我们可以提供-b
选项,如下所示。
$ git status -b
详细状态(Verbose Status)
We can also list current tracked and untracked files and folders in a verbose mode. We will use -v
option.
我们还可以详细模式列出当前已跟踪和未跟踪的文件和文件夹。 我们将使用-v
选项。
$ git status -v
翻译自: https://www.poftut.com/git-status-show-the-working-tree-status/
git 显示文件状态