git stash apply和git stash apply --index有什么区别? [英] What's the difference between git stash apply and git stash apply --index?

查看:231
本文介绍了git stash apply和git stash apply --index有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我执行 git stash -a 后,只要运行 git stash apply git stash apply --index ,我什至会得到相同的结果尽管我的WIP目录已暂存更改,未暂存(但已跟踪更改)和未跟踪文件.

Whenever I run git stash apply and git stash apply --index after having done git stash -a I get the same result even though my WIP directory has staged changes, unstaged (but tracked changes) and untracked files.

这正常吗? git stash是否应该应用不返回索引?

Is this normal? Shouldn't git stash apply not return the index?

推荐答案

使用 git stash apply 对文件的更改已重新应用,但之前暂存的文件不会被重新保存阶段.

Using git stash apply the changes to your files were reapplied, but the file(s) you staged before wouldn't be re-staged.

如果要执行此操作,可以添加-index 选项,以告诉命令尝试重新应用暂存的更改.

If you want to do that, you could add the --index option to tell the command to try to reapply the staged changes.

这篇关于git stash apply和git stash apply --index有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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