1
0
mirror of https://github.com/k88hudson/git-flight-rules.git synced 2025-03-10 12:48:43 -03:00

add note about git stash pop --index 0

This commit is contained in:
yaame 2019-09-20 05:43:05 +00:00
parent 4252773598
commit f1a2195372
2 changed files with 6 additions and 0 deletions

View File

@ -617,6 +617,9 @@ $ git reset HEAD^
$ git stash pop --index 0
```
NOTE 1: The reason to use `pop` here is want to keep idempotent as more as possible.
NOTE 2: Your staged files will be marked as unstaged if you miss `--index` flag.[this link](https://stackoverflow.com/questions/31595873/git-stash-with-staged-files-does-stash-convert-staged-files-to-unstaged?answertab=active#tab-top) will explain it to you.
## Unstaged Edits
<a href="move-unstaged-edits-to-new-branch"></a>

View File

@ -265,6 +265,9 @@ $ git reset HEAD^
$ git stash pop --index 0
```
注意1: 这里使用`pop`仅仅是因为想尽可能保持幂等。
注意2: 假如你不加上`--index`你会把暂存的文件标记为为存储.这个[链接](https://stackoverflow.com/questions/31595873/git-stash-with-staged-files-does-stash-convert-staged-files-to-unstaged?answertab=active#tab-top) 解释得比较清楚。不过是英文的其大意是说这是一个较为底层的问题stash时会做2个commit其中一个会记录index状态staged的文件等东西另一个记录worktree和其他的一些东西如果你不在apply时加indexgit会把两个一起销毁所以staged里就空了
## 未暂存(Unstaged)的内容
<a href="move-unstaged-edits-to-new-branch"></a>