C:\Users\lenovo\Desktop\git文章\spring>git status On branch master Your branch is up to date with 'origin/master'.
Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: likeben.txt
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: likeben.txt
你可以看到多出了一些输出。文件likeben.txt再一次出现在了Changes not staged for commit:这行下面,着说明已跟踪的文件发生了变化,但是没有提交到暂存区,要暂存这次更新,需要运行git add命令。这个命令不光可以用来追踪新文件,也可以用来把已跟踪的文件添加到暂存区。
C:\Users\lenovo\Desktop\git文章\spring>git status On branch master Your branch is up to date with 'origin/master'.
Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: likeben.txt
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: README.md
C:\Users\lenovo\Desktop\git文章\spring>git status On branch master Your branch is up to date with 'origin/master'.
Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: README.md new file: likeben.txt
那么假如我又重新修改了README.md文件呢?接下来会是这样
1 2 3 4 5 6 7 8 9 10 11 12 13
C:\Users\lenovo\Desktop\git文章\spring>git status On branch master Your branch is up to date with 'origin/master'.
Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: README.md new file: likeben.txt
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: README.md
D:\BaiduSyncdisk\给公司电脑传输内容\git文章\spring>git status On branch master Your branch is up to date with 'origin/master'.
Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: README.md new file: likeben.txt
D:\BaiduSyncdisk\给公司电脑传输内容\git文章\spring>git commit [master8a454c9] 这是我的第一次commit提交 On branch master Your branch is up to date with 'origin/master'. Changes to be committed: new file: likeben.txt 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 likeben.txt
D:\BaiduSyncdisk\给公司电脑传输内容\git文章\spring>git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits)
D:\BaiduSyncdisk\给公司电脑传输内容\git文章\spring>git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits)
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: likeben.txt
no changes added to commit (use "git add" and/or "git commit -a")
D:\BaiduSyncdisk\给公司电脑传输内容\git文章\spring>git status On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits)
diff --git a/likeben.txt b/likeben.txt index 2c813ea..9cc539e 100644 --- a/likeben.txt +++ b/likeben.txt @@-1,2 +1,3@@ likeben -第一次波纹疾走 \ No newline at end of file +第一次波纹疾走 +第二次波纹疾走 \ No newline at end of file
commit 8a454c943dcc6ae29415349795867e70c6348384 Author: wuheng <849808229@qq.com> Date: Thu Oct 2716:53:472022 +0800
这是我的第一次commit提交 On branch master Your branch is up to date with 'origin/master'. Changes to be committed: new file: likeben.txt