From f1a219537292a2406ac660ad2876a83ecee90b0d Mon Sep 17 00:00:00 2001
From: yaame <969519545@qq.com>
Date: Fri, 20 Sep 2019 05:43:05 +0000
Subject: [PATCH] add note about `git stash pop --index 0`
---
README.md | 3 +++
README_zh-CN.md | 3 +++
2 files changed, 6 insertions(+)
diff --git a/README.md b/README.md
index c718776..d8e8c69 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/README_zh-CN.md b/README_zh-CN.md
index 32db360..1dc3a14 100644
--- a/README_zh-CN.md
+++ b/README_zh-CN.md
@@ -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时加index,git会把两个一起销毁,所以staged里就空了)。
+
## 未暂存(Unstaged)的内容