存储更改,同时将更改保留在Git中的工作目录中 [英] Stash changes while keeping the changes in the working directory in Git

查看:55
本文介绍了存储更改,同时将更改保留在Git中的工作目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个git stash命令可以存储您的更改,但也将其保存在工作目录中?那么基本上就是git stash; git stash apply了吗?

Is there a git stash command that stashes your changes, but keeps them in the working directory too? So basically a git stash; git stash apply in one step?

推荐答案

关于它的价值,另一种方法是进行您要保留的更改,然后使用--keep-index存放所有内容:

For what it's worth, another way to do this is to stage the changes you want to keep, and then stash everything using --keep-index:

$ git add modified-file.txt
$ git stash push --keep-index

上面的命令将隐藏所有内容,但会将文件保留在您的工作目录中.

The commands above will stash everything, but it will leave the files staged in your working directory.

官方Linux Kernel Git文档中获得git stash 或来自 git-scm :

如果使用--keep-index选项,则已添加到索引的所有更改均保持不变.

If the --keep-index option is used, all changes already added to the index are left intact.

这篇关于存储更改,同时将更改保留在Git中的工作目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆