在Git中,要保留工作目录中的更改,可以使用以下代码示例:
$ git stash
$ git stash list
$ git stash apply
$ git stash drop
完整的代码示例如下:
# 保存工作目录中的更改
$ git stash
# 查看已暂存的更改
$ git stash list
# 恢复暂存的更改到工作目录
$ git stash apply
# 删除已应用的暂存更改
$ git stash drop
这些命令可以帮助你在Git中保留工作目录中的更改。