git status

yo3nglau

2023/05/22

Categories: Technical Blogs Tags: Git Commands

Name

git-status - Show the working tree status

Description

Displays paths that have differences between the index file and the current HEAD commit, paths that have differences between the working tree and the index file, and paths in the working tree that are not tracked by Git. The first are what you would commit by running git commit; the second and third are what you could commit by running git add before running git commit.

Options

-s, --short

​ Give the output in the short-format.

--long

​ Give the output in the long-format. This is the default.

Short Format

In the short-format, the status of each path is shown as one of these forms

XY PATH
XY ORIG_PATH -> PATH

where ORIG_PATH is where the renamed/copied contents came from. ORIG_PATH is only shown when the entry is renamed or copied. The XY is a two-letter status code.

There are three different types of states that are shown using this format, and each one uses the XY syntax differently:

Note that the term merge here also includes rebases using the default --merge strategy, cherry-picks, and anything else using the merge machinery.

In the following table, these three classes are shown in separate sections, and these characters are used for X and Y fields for the first two sections that show tracked paths:

Resources

https://git-scm.com/docs/git-status