1
0
mirror of https://github.com/k88hudson/git-flight-rules.git synced 2025-06-17 05:21:35 -03:00

fix case: switch stage & unstage files

This commit is contained in:
yaame
2019-09-11 05:01:59 +00:00
parent 5c57fb5ea5
commit 260a140bda
2 changed files with 12 additions and 4 deletions

View File

@ -254,11 +254,15 @@ $ git add -N filename.x
<a href="unstaging-edits-and-staging-the-unstaged"></a>
### 我想把暂存的内容变成未暂存,把未暂存的内容暂存起来
`stash`是个栈,我们只需要`stash`起来,然后`pop`/`apply --index x`即可(`apply`会保留在栈中)
多数情况下你应该将所有的内容变为未暂存然后再选择你想要的内容进行commit
但假定你就是想要这么做这里你可以创建一个临时的commit来保存你已暂存的内容然后暂存你的未暂存的内容并进行stash。然后reset最后一个commit将原本暂存的内容变为未暂存最后stash pop回来。
```sh
$ git commit -m "WIP"
$ git add .
$ git stash
$ git stash pop --index 1
$ git reset HEAD^
$ git stash pop --index 0
```
## 未暂存(Unstaged)的内容