- 新建一个文件,git状态是Untracked
- 添加到暂存区是Staged
- 提交后是Unmodified
- 在修改是Modified
apes@DESKTOP-3496068 MINGW64 ~/Desktop/gitStatus (master)
$ git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
apes@DESKTOP-3496068 MINGW64 ~/Desktop/gitStatus (master)
$ touch status.txt
apes@DESKTOP-3496068 MINGW64 ~/Desktop/gitStatus (master)
$ ls
status.txt
apes@DESKTOP-3496068 MINGW64 ~/Desktop/gitStatus (master)
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
status.txt
nothing added to commit but untracked files present (use "git add" to track)
apes@DESKTOP-3496068 MINGW64 ~/Desktop/gitStatus (master)
$ git add status.txt
apes@DESKTOP-3496068 MINGW64 ~/Desktop/gitStatus (master)
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: status.txt
apes@DESKTOP-3496068 MINGW64 ~/Desktop/gitStatus (master)
$ git commit status.txt
[master (root-commit) d73044a] 1
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 status.txt
apes@DESKTOP-3496068 MINGW64 ~/Desktop/gitStatus (master)
$ git status
On branch master
nothing to commit, working tree clean
apes@DESKTOP-3496068 MINGW64 ~/Desktop/gitStatus (master)
$ git log
commit d73044abde1d8c43f4c86d2f38ba314b81bb4432 (HEAD -> master)
Author: zhangys <zhangys@datafinedo.cn>
Date: Mon Mar 28 19:17:25 2022 +0800
1
apes@DESKTOP-3496068 MINGW64 ~/Desktop/gitStatus (master)
$ git reflog
d73044a (HEAD -> master) HEAD@{0}: commit (initial): 1
apes@DESKTOP-3496068 MINGW64 ~/Desktop/gitStatus (master)
$ vim status.txt
apes@DESKTOP-3496068 MINGW64 ~/Desktop/gitStatus (master)
$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: status.txt
no changes added to commit (use "git add" and/or "git commit -a")
Comments | NOTHING