暂时(保存,恢复,删除)工作进度 git stash
- 在工作目录提交过的文件做下修改 然后
git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: git8.md
no changes added to commit (use "git add" and/or "git commit -a")
-
git stash save '修改了git8.md'
保存当前进度,之前做过的修改恢复到最开始
Saved working directory and index state On master: 修改了git8.md
-
git stash list
显示出工作进度的一个列表
stash@{0}: On master: 修改了git8.md
-
git stash show -p stash@{0}
对比进度跟工作目录的区别
diff --git a/git8.md b/git8.md
index b1892a0..04f249a 100644
--- a/git8.md
+++ b/git8.md
@@ -1 +1,2 @@
### 保存,恢复,删除工作进度 stash
+- `git stash save '修改了git8.md'`
-
git stash apply stash@{0}
恢复保存中的工作进度
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: git8.md
no changes added to commit (use "git add" and/or "git commit -a")
-
git stash drop stash@{0}
删除工作进度
-
git stash list
上次保存的工作进度就不存在了
- 另
git stash pop stash@{0}
在恢复工作进度时,可直接删除工作进度
网友评论