Information Technology Reference
In-Depth Information
• The first snapshot (the working directory): the file contains foo
• The second snapshot (the staging area): the file contains lorem
• The third snapshot (HEAD): the file contains lorem
Thus _M means that the file in the working directory differs from the file stored in
the staging area while at the same time the file stored in the staging area is identical to
the file in the revision pointed by HEAD .
The two lettered codes printed by $ git status -sb , such as _M , lets you
know the differences between the three snapshots. If the two lettered code is XY then:
X lets you know the differences between the third snapshot ( HEAD ) and
the second snapshot (the staging area)
Y lets you know the differences between the second snapshot (the staging
area) and the first snapshot (the working directory)
Let's stage the lorem.txt file with $ git add lorem.txt . The output of $
git status -s is following:
M_ lorem.txt
The code is M_ and this time the lorem.txt file stored in the three snapshots con-
tains:
• The first snapshot (the working directory): the file contains foo
• The second snapshot (the staging area): the file contains foo
• The third snapshot ( HEAD ): the file contains lorem
Thus M_ means that the file in the working directory is identical as the file in the
staging area; the file stored in the staging area differs from the file stored in HEAD .
If you commit this modification with $ git commit then all three snapshots be-
come synchronized again. All of them would contain the file lorem.txt with the
foo string.
Once you grasp the idea behind the three snapshots it is easy to understand the way
the $ git reset command works. This command changes the three snapshots:
HEAD, the staging area, and the working directory. It has three important options --
Search WWH ::




Custom Search