📅  最后修改于: 2023-12-03 15:00:56.826000             🧑  作者: Mango
git status
是一个Git命令,用于查看当前Git仓库中所有已修改的文件的状态。
在终端窗口中,键入以下命令:
git status
该命令将列出在工作目录中已修改的文件以及暂存区中的文件。
当运行git status
命令时,Git将返回如下所示的信息:
On branch <branch>
Your branch is up-to-date with 'origin/<branch>'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: <file1>
deleted: <file2>
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: <file3>
Untracked files:
(use "git add <file>..." to include in what will be committed)
<file4>
从上面的输出可以看出,git status
命令将输出以下三种类型的文件状态:
git add
命令放入暂存区。以下示例演示了如何使用git status
命令:
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: README.md
Untracked files:
(use "git add <file>..." to include in what will be committed)
scripts/
no changes added to commit (use "git add" and/or "git commit -a")
这表明当前仓库中README.md
文件已被修改,但未被放入暂存区中。此外,还有一个名为scripts/
的新文件夹,尚未被添加到版本控制中。
git status
命令是一种用于查看Git仓库状态的常用工具。它可以帮助程序员了解仓库中哪些文件已被更改,哪些文件已通过git add
命令放入暂存区,以及哪些文件尚未添加到版本控制中。