git stash命令用于将当前工作目录中的所有未提交的更改(包括暂存和未暂存的更改)暂时保存起来,以便后续恢复使用。具体的使用方法如下:
将所有未暂存的更改暂时保存起来:git stash将所有未暂存的更改和已暂存的更改一起保存起来:git stash -u查看当前所有保存的stash:git stash list恢复最新的stash,并将其从stash列表中移除:git stash pop恢复指定的stash,并将其从stash列表中移除:git stash pop stash@{n}应用最新的stash,但不将其从stash列表中移除:git stash apply应用指定的stash,但不将其从stash列表中移除:git stash apply stash@{n}删除最新的stash:git stash drop删除指定的stash:git stash drop stash@{n}通过以上命令,可以灵活地使用git stash保存和恢复工作目录中的更改,以便在需要时快速切换工作状态。


