..." to">
当前位置:   article > 正文

Git — 版本管理_on branch master changes not staged for commit: (u

on branch master changes not staged for commit: (use "git add ..." to
Git 版本管理

修改已经提交的 readme.txt 文件:

Git is a distributed version control system.
Git is free software.
  • 1
  • 2
查看 git 库状态

执行 git status 命令查看结果:

$ git status
On branch 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.txt

no changes added to commit (use "git add" and/or "git commit -a")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • git status 命令用于查看仓库当前状态
  • 输出返回 readme.txt 被修改过,但还没有准备提交的修改。
查看 git 库具体修改内容

使用 git diff 命令查看具体修改内容:

$ git diff readme.txt
diff --git a/readme.txt b/readme.txt
index 46d49bf..9247db6 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,2 +1,2 @@
-Git is a version control system.
+Git is a distributed version control system.
 Git is free software.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • git diff 就是查看 difference,显示的格式正是 Unix 通用的 diff 格式
查看 add 和 commit 之后的状态
  1. 执行 git add 之后,执行 git status 查看状态:

    $ git status
    On branch master
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
    	modified:   readme.txt
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
  2. 执行 git commit 之后,执行 git status 查看状态:

    $ git status
    On branch master
    nothing to commit, working tree clean
    
    • 1
    • 2
    • 3

注意:可以看出,当前没有需要提交的修改,工作目录是干净的(working tree clean)。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/264792
推荐阅读
相关标签
  

闽ICP备14008679号