Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么git stash创建两个提交_Git_Git Stash - Fatal编程技术网

为什么git stash创建两个提交

为什么git stash创建两个提交,git,git-stash,Git,Git Stash,这是一个历史图,其中包含一个使用git log--graph--all refs/stash的stash ref: * commit e5e6f3db57db6237a4334dc69a9a229f1cd7bd82 (refs/stash) |\ Merge: 2a1a05a e918d31 | | Author: user <xxx@yyy.com> | | Date: Sun Jan 12 12:27:13 2020 +0000 | | | | On mast

这是一个历史图,其中包含一个使用
git log--graph--all refs/stash
的stash ref:

*   commit e5e6f3db57db6237a4334dc69a9a229f1cd7bd82 (refs/stash)
|\  Merge: 2a1a05a e918d31
| | Author: user <xxx@yyy.com>
| | Date:   Sun Jan 12 12:27:13 2020 +0000
| | 
| |     On master: some stash comment
| | 
| * commit e918d315535c6c6ade2dfb0538039d527dd0cd6e
|/  Author: user <xxx@yyy.com>
|   Date:   Sun Jan 12 12:27:13 2020 +0000
|   
|       index on master: 2a1a05a init
| 
* commit 2a1a05a258d3877ed1f6d32dfd57ae1941530418 (HEAD -> master)
  Author: user <xxx@yyy.com>
  Date:   Sun Jan 12 12:09:51 2020 +0000

      init
*提交e5e6f3db57db6237a4334dc69a9a229f1cd7bd82(参考/隐藏)
|\合并:2a1a05a e918d31
||作者:用户
||日期:Sun Jan 12 12:27:13 2020+0000
| | 
||关于大师:一些隐藏评论
| | 
|*提交E918D315535C6C6ADE2DF0538039D527DD0CD6E
|/作者:用户
|日期:太阳1月12日12:27:13 2020+0000
|   
|主机上的索引:2a1a05a init
| 
*提交2a1a05a258d3877ed1f6d32dfd57ae1941530418(主机->主机)
作者:用户
日期:Sun Jan 12:09:51 2020+0000
初始化
为什么需要提交
e5e6

它看起来像一个

隐藏项表示为提交,其树记录工作目录的状态,其第一个父项是创建该项时头部的提交。
第二个父级的树记录创建条目时索引的状态,并将其作为头提交的子级

祖先图如下所示:

       .----W
      /    /
-----H----I
其中H是头提交,I是记录索引状态的提交,W是记录工作树状态的提交

如“”中所述

由commit
W
和commit
I
表示的隐藏条目,但
W
足以查找
I

无论是
W
还是
I
都足以找到
H
,git stash将自动找到所有三个提交


另请参见。

好的,现在我在想为什么第二次提交是合并?@kan我已经编辑了答案,并添加了一个链接,指向有关隐藏条目的更多解释。