2013-11-27 217 views
5

我已經開始使用Git了,因爲我認爲它是一個更好的版本控制器。描述Git符號

有人可以幫我理解什麼git status -s符號的含義?

+1

'git的幫助status' – geoffspear

+1

谷歌: 「混帳地位」 1項: 的https:// WWW .kernel.org/pub/software/scm/git/docs/git-status.html –

+1

在'output - > short format'標題下有非常明確的說明:https://www.kernel.org/pub/software/scm /git/docs/git-status.html#_short_format – meagar

回答

6

如果在終端編寫

git help status 

選項列表中會出現,告訴你-s指的是git的狀態的短格式。

如果你去輸出 - >短格式你會發現所有的符號解釋:

Short Format 
    In the short-format, the status of each path is shown as 

     XY PATH1 -> PATH2 

    where PATH1 is the path in the HEAD, and the " -> PATH2" part is shown 
    only when PATH1 corresponds to a different path in the index/worktree 
    (i.e. the file is renamed). The XY is a two-letter status code. 

    The fields (including the ->) are separated from each other by a single 
    space. If a filename contains whitespace or other nonprintable 
    characters, that field will be quoted in the manner of a C string 
    literal: surrounded by ASCII double quote (34) characters, and with 
    interior special characters backslash-escaped. 

    For paths with merge conflicts, X and Y show the modification states of 
    each side of the merge. For paths that do not have merge conflicts, X 
    shows the status of the index, and Y shows the status of the work tree. 
    For untracked paths, XY are ??. Other status codes can be interpreted 
    as follows: 

    · ' ' = unmodified 

    · M = modified 

    · A = added 

    · D = deleted 

    · R = renamed 

    · C = copied 

    · U = updated but unmerged 

    Ignored files are not listed, unless --ignored option is in effect, in 
    which case XY are !!. 

    X   Y  Meaning 
    ------------------------------------------------- 
      [MD] not updated 
    M  [ MD] updated in index 
    A  [ MD] added to index 
    D   [ M] deleted from index 
    R  [ MD] renamed in index 
    C  [ MD] copied in index 
    [MARC]   index and work tree matches 
    [ MARC]  M work tree changed since index 
    [ MARC]  D deleted in work tree 
    ------------------------------------------------- 

    D   D unmerged, both deleted 
    A   U unmerged, added by us 
    U   D unmerged, deleted by them 
    U   A unmerged, added by them 
    D   U unmerged, deleted by us 
    A   A unmerged, both added 
    U   U unmerged, both modified 
    ------------------------------------------------- 
    ?   ? untracked 
    !   ! ignored 
    -------------------------------------------------