Home Explore Blog CI



git

6th chunk of `Documentation/git-reset.adoc`
1979b92175e037626f152b9a5aacdda94ba1183b27fba959000000010000090b
 the patch mode of `git add`, in order to select all remaining
    uncommitted changes.
<7> Once again, check to verify that you've included what you want to. You may
    also wish to verify that git diff doesn't show any remaining changes to be
    committed later.
<8> And finally create the final commit.


DISCUSSION
----------

The tables below show what happens when running:

----------
git reset --option target
----------

to reset the `HEAD` to another commit (`target`) with the different
reset options depending on the state of the files.

In these tables, `A`, `B`, `C` and `D` are some different states of a
file. For example, the first line of the first table means that if a
file is in state `A` in the working tree, in state `B` in the index, in
state `C` in `HEAD` and in state `D` in the target, then `git reset --soft
target` will leave the file in the working tree in state `A` and in the
index in state `B`.  It resets (i.e. moves) the `HEAD` (i.e. the tip of
the current branch, if you are on one) to `target` (which has the file
in state `D`).

....
working index HEAD target         working index HEAD
----------------------------------------------------
 A       B     C    D     --soft   A       B     D
			  --mixed  A       D     D
			  --hard   D       D     D
			  --merge (disallowed)
			  --keep  (disallowed)
....

....
working index HEAD target         working index HEAD
----------------------------------------------------
 A       B     C    C     --soft   A       B     C
			  --mixed  A       C     C
			  --hard   C       C     C
			  --merge (disallowed)
			  --keep   A       C     C
....

....
working index HEAD target         working index HEAD
----------------------------------------------------
 B       B     C    D     --soft   B       B     D
			  --mixed  B       D     D
			  --hard   D       D     D
			  --merge  D       D     D
			  --keep  (disallowed)
....

....
working index HEAD target         working index HEAD
----------------------------------------------------
 B       B     C    C     --soft   B       B     C
			  --mixed  B       C     C
			  --hard   C       C     C
			  --merge  C       C     C
			  --keep   B       C     C
....

....
working index HEAD target         working index HEAD
----------------------------------------------------

Title: Git Reset Options and Their Effects on File States
Summary
The text describes the different options available for `git reset` and their effects on the working tree, index, and HEAD, with tables illustrating the outcomes for various file states and reset options, including `--soft`, `--mixed`, `--hard`, `--merge`, and `--keep`.