存储使用Atlassian Sourcetree所做的更改 [英] Stash the changes made with atlassian sourcetree

查看:208
本文介绍了存储使用Atlassian Sourcetree所做的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目中更改了很多文件.我想隐藏2个文件,但由于我从未这样做,所以我有点害怕犯错.

I have a lot of files changed in my project. I want to stash 2 files but i'm a bit afraid to make a mistake since i never did this.

如果我现在藏起来,会只藏两个暂存的文件吗?

If i would stash now, will it only stash the 2 staged files?

如果我未标记保持阶段性更改",它会恢复到以前的状态吗? 这听起来可能很愚蠢,但最好还是保存一下,对不起.

And if I don't mark the "Keep staged changes", will it then revert to how it was before? This might sound stupid, but better save then sorry.

推荐答案

这通常适用于Git,而不仅仅是SourceTree.当您存储更改时,将要存储的项目是工作副本和暂存区中对跟踪文件的更改. 这些更改将保存在存储中,并还原到工作副本和索引中.

This applies to Git in general, not just with SourceTree. When you stash changes, the items that will be stashed are the changes to tracked files in your working copy and in the staging area. Those changes will be saved in the stash, and reverted in the working copy and index.

当您选择保留索引/暂存区中的更改时,这些更改仍会保留,但是Git不会在暂存区中还原它们. ,您做了几个不相关的更改,并且只想运行其中的一些更改,而又不影响不相关的更改.

When you choose to keep changes in the index/staging area, those changes will still be stashed, but Git won't also revert them in the staging area. This is useful if, for example, you make several unrelated changes, and you want to run tests only some of those changes, without having the unrelated ones affect the test.

存储是安全的.如果您想找回隐藏的更改,只需将其弹出隐藏即可.

Stashing is safe. If you want to get your stashed changes back, you just pop them back out of the stash.

但是,通常不会隐藏未跟踪的文件.如果您还希望隐藏这些文件,则需要在命令行上将其他选项传递给git stash(适用于Windows的SourceTree当前没有这样的选项.我不知道Mac是否同样如此)版本):

However, untracked files aren't normally stashed. If you want to also stash those files, you need to pass an additional option to git stash on the command line (SourceTree for Windows doesn't currently have such an option. I don't know if the same is true for the Mac version):

git stash save --include-untracked
# Or shorter
git stash save -u

另请参见

  • git stash 的官方Linux内核文档./li>

    See Also

    • The official Linux Kernel documentation for git stash.
    • 这篇关于存储使用Atlassian Sourcetree所做的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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