Git的四种状态分析

1.新文件未被跟踪

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    README

nothing added to commit but untracked files present (use "git add" to track)

2.文件被跟踪但修改未暂存

$ 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:   CONTRIBUTING.md

3.文件修改已暂存但未提交

$ 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)

    new file:   README

4.文件修改已提交

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

原创文章,作者:huoxiaoqiang,如若转载,请注明出处:https://www.huoxiaoqiang.com/experience/jingyan/1659.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注