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:
parent
4252773598
commit
f1a2195372
@ -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>
|
||||
|
@ -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)的内容
|
||||
|
||||
<a href="move-unstaged-edits-to-new-branch"></a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user