Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reference for git status shorthand

Tags:

git

Is there a reference for all of the status notations (e.g. AD, MM, ??) output from git status --porcelain? I'm parsing this output and need to make sure I have all the permutations covered. Reading through the git source code, it looks like the output is assembled on the fly rather than templated and I'm not confidant in my ability to find every edge case there.

Here's what I have:

??: 'untracked',
A: 'staged',
AD: 'staged_deleted',
AM: 'staged_modified',
D: 'deleted',
M: 'modified',
MM: 'staged_modified',
R: 'renamed',
UU: 'conflicted'
like image 900
maxhallinan Avatar asked Sep 12 '25 18:09

maxhallinan


1 Answers

It's under the Short Format section of git status:

or 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

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
-------------------------------------------------
like image 101
Yu Hao Avatar answered Sep 15 '25 09:09

Yu Hao