I have read the documentation for git reset
. However, I am having a hard time understanding the difference between
git reset --merge
and
git reset --keep
Again, I would like to stress that I'm interested in knowing the difference in how these two options work, not the possible scenarios where they could be used, like in this other question.
Please provide an explanation and/or example.
They are different when dealing with a merge conflict, for example this will generate a conflict
git init
echo 333 > foo.txt
git add foo.txt
git commit -m 333
git checkout -b feature
echo 444 > foo.txt
git commit -am 444
git checkout master
echo 555 > foo.txt
git commit -am 555
git merge feature
Then
$ git reset --keep
fatal: Cannot do a keep reset in the middle of a merge.
$ cat foo.txt
<<<<<<< HEAD
555
=======
444
>>>>>>> feature
Versus
$ git reset --merge
$ cat foo.txt
555