参考git status速记

时间:2017-06-09 01:51:47

标签: git

是否有AD的所有状态记号(例如MM??git status --porcelain)的参考?我解析了这个输出,需要确保我已经涵盖了所有的排列。通过git源代码阅读,看起来输出是动态组合而不是模板化的,而且我并不知道我在那里找到每个边缘情况的能力。

以下是我所拥有的:

??: 'untracked',
A: 'staged',
AD: 'staged_deleted',
AM: 'staged_modified',
D: 'deleted',
M: 'modified',
MM: 'staged_modified',
R: 'renamed',
UU: 'conflicted'

1 个答案:

答案 0 :(得分:2)

它位于git status的{​​{3}}部分:

  

或具有合并冲突的路径,XY显示合并每一侧的修改状态。对于没有合并冲突的路径,X显示索引的状态,Y显示工作树的状态。对于未跟踪的路径,XY??。其他状态代码可以解释如下:

     

' ' =未修改

     

M =已修改

     

A =已添加

     

D =已删除

     

R =重命名

     

C =复制

     

U =已更新但未合并

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