wangn

look up

博客园 首页 联系 订阅 管理

git status 用于查看工作区与暂存区的已tracked及untracked的所有文件status.

以下为help结果。

git help status

 

NAME

git-status - Show the working tree status

DESCRIPTION

Displays paths that have differences between the index file and the current HEAD commit, paths that have differences between the working tree and the index file, and paths in the working tree that are not tracked by Git (and are not ignored by gitignore(5)). The first are what you would commit by running git commit; the second and third are what you couldcommit by running git add before running git commit.


执行status前我做了哪些动作,

1、修改了1.txt并执行git add 1.txt
2、修改了2.txt,无其他操作
3、新增了3.txt文件,无其他操作

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

    modified:   1.txt

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: 2.txt Untracked files: (use "git add <file>..." to include in what will be committed) 3.txt 

Changes to be committed: 表示 tracked & modified % in stage waiting for commit 的文件
Changes not staged for commit:表示 tracked & modified & not in stage 的文件
Untracked files:表示 untracked 文件


通过git add 之后,文件都处于 in stage 状态,changes to be commited。

等待提交。

$ git add .

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
 (use "git reset HEAD <file>..." to unstage)

        modified:   1.txt
        modified:   2.txt
        new file:   3.txt

要注意区分各个状态间的差异! 

posted on 2017-09-13 15:28  wangn  阅读(816)  评论(0编辑  收藏  举报