Why does git stash create 2 commit objects? It seems 1 was adequate

When executed git stash, 2 commits are created. One of them refers to stashref and has 2 parent commits. One parent is an index of where we made the cache. The other parent has the actual content of what we hid.
Why does a wallet require 2 fixes? It seems to me that only 1 was enough. That is, just do a stashref for the commit having the actual contents.
Would it work?

+4
source share
1 answer

git stash . , , : - , Git , , , git add - . / HEAD .

, git stash , , . , . , git commit -a.

git stash , . , , . , , . -u -a, git stash , , .

, , . 1 , () (b) git stash pop --index, --index, , , . , , .


1 --keep-index , , , , - . . , git stash , . . .

+8

Source: https://habr.com/ru/post/1665600/


All Articles