鍍金池/ 教程/ Java/ 第9關(guān) status
第13關(guān) stash
第37關(guān) push_branch
附錄A Git 學(xué)習(xí)資源
第54關(guān) submodule
第15關(guān) restructure
第18關(guān) push_tags
第17關(guān) tag
前言
第22關(guān) reset_soft
Githug 安裝和使用方法
第41關(guān) repack
第16關(guān) log
第7關(guān) ignore
第10關(guān) number_of_files_committed
第29關(guān) diff
第1關(guān) init
第4關(guān) commit
第33關(guān) checkout_tag
第20關(guān) commit_in_future
第14關(guān) rename
第39關(guān) fetch
第9關(guān) status
第11關(guān) rm
第27關(guān) remote_add
第3關(guān) add
第24關(guān) remote
第26關(guān) pull
第44關(guān) rename_commit
第23關(guān) checkout_file
第32關(guān) checkout
第55關(guān) contribute
第47關(guān) reorder
關(guān)卡列表
第35關(guān) branch_at
第5關(guān) clone
第45關(guān) squash
第43關(guān) grep
第36關(guān) delete_branch
第53關(guān) conflict
第34關(guān) checkout_tag_over_branch
第42關(guān) cherry-pick
第19關(guān) commit_amend
Githug 通關(guān)攻略
附錄C Vim 常用命令
第48關(guān) bisect
第46關(guān) merge_squash
第2關(guān) config
附錄B Linux 常用命令
第21關(guān) reset
第50關(guān) find_old_branch
第12關(guān) rm_cached
第8關(guān) include
第31關(guān) branch
第49關(guān) stage_lines
第30關(guān) blame
第52關(guān) restore
第51關(guān) revert
第28關(guān) push
第25關(guān) remote_url
第40關(guān) rebase
第38關(guān) merge
第6關(guān) clone_to_folder

第9關(guān) status

There are some files in this repository, one of the files is untracked, which file is it?

倉庫中有一個文件是未被 Git 管理的,請問是哪一個文件?

Git 管理下的文件有多種狀態(tài),在工作中你經(jīng)常需要先查詢文件狀態(tài)才能決定下一步做什么或怎么做,所以它的重要性和 Linux 的 ls 命令是一樣重要的,是幾乎所有操作的起點。

查看倉庫狀態(tài)的命令是:

$ git status
$ git status -s

第1條命令表示以詳細(xì)格式查看,第2條命令表示以緊湊格式查看。默認(rèn)的詳細(xì)格式包含以下內(nèi)容:

  • untracked:倉庫里新建的文件,或者從別的地方復(fù)制到倉庫里的文件,它們的狀態(tài)都是 "untracked",它們被用紅字顯示在查詢結(jié)果的 "Untrakced files" 段落中。

  • modified:被編輯過的文件的狀態(tài)就變?yōu)?"modified",它們被用紅字顯示在查詢結(jié)果的 "Changes not staged for commit" 段落中。

  • staged:通過 git add 命令加入到暫存區(qū)的文件的狀態(tài)就變?yōu)?"staged",它們被用綠字顯示在查詢結(jié)果的 "Changes to be committed" 段落中。

如果上面的狀態(tài)把你搞亂了,請翻到前面第3關(guān),再仔細(xì)看一下“Git 文件生命周期”那張圖。

第9關(guān)和第10關(guān)考核是正是你對 git status 查詢結(jié)果的閱讀能力,第9關(guān)是要你從查詢結(jié)果中識別出 untracked 狀態(tài)的文件。

第9關(guān)過關(guān)畫面如下:

http://wiki.jikexueyuan.com/project/githug-walkthrough/images/level-9-status.png" alt="第9關(guān) status" />