本页内容

git stash

使用 Git,您可以将当前的一组更改暂存到一个名为“stash”的虚拟暂存区中。stash 非常有用,例如,您可以将一组更改暂存起来,以便处理优先级更高的任务,或者从另一个仓库拉取新的更改。

暂存本地更改

要暂存所有本地更改,请依次执行:Tools >Git >Local Repository >Stash ,然后选择“Stash ”。工作副本将重置为上次提交后的状态。

若要保存未暂存文件的当前状态并将仓库重置为已暂存状态,请选择“Stash Unstaged Files ”。

管理暂存的更改

若要显示一个对话框,其中列出所有已知的暂存更改并提供恢复、查看或删除的选项,请选择Stashes

创建快照

若要以指定名称保存当前工作的快照以便日后参考,请选择Take Snapshot 。工作副本不会发生改变。例如,如果您想尝试某项操作,但后来发现它不起作用,您可以丢弃这些更改并恢复到快照的状态。

从暂存区提取

若要从暂存列表中移除单个暂存状态,并将其应用到当前工作树状态之上,请依次进入“Tools ” > “Git ” > “Local Repository ” > “Stash ”,然后选择“Stash Pop ”。

另请参阅 《如何使用 Git》《Git 入门》。

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.