简体   繁体   English

藏匿差异,在源代码树中停止跟踪

[英]Difference in Stash, stop tracking in Source Tree

Just wondering the difference between stop tracking and stash in GIT. 只是想知道GIT中停止跟踪和隐藏之间的区别。 I am using source tree as the tool. 我正在使用源代码树作为工具。 So is that possible to revert back when stash or stop tracking later point of time if needed. 这样可以在存储时恢复原状,或者在需要时停止跟踪后续时间点。

What would be the best option if I want to hide the changes temporarily till I commit and pull the latest from remote and then add those changes. 如果我想暂时隐藏更改,直到提交并从远程获取最新信息,然后添加这些更改,那将是最好的选择。

Thanks 谢谢

Stash is the right way to go. 藏匿是正确的方法。 You don't really want to stop tracking your files, right? 您真的不想停止跟踪文件,对吗? You just want to temporarily put your changes aside, and then restore them - this is what Stash is designed to do. 您只想暂时搁置更改,然后将其还原-这就是Stash设计的目的。

For more information about git stash : https://git-scm.com/book/en/v2/Git-Tools-Stashing-and-Cleaning 有关git stash更多信息: https : //git-scm.com/book/en/v2/Git-Tools-Stashing-and-Cleaning

You mentioned that after git stash you still see uncommitted changes. 您提到,在git stash您仍然看到未提交的更改。 One way this can happen is if you are stashing changes in .gitignore . 发生这种情况的一种方法是,如果您要存储.gitignore更改。 For example: Suppose you add a file called 1.txt to your working directory, and then you add the line 1.txt to .gitignore . 例如:假设您在工作目录中添加了一个名为1.txt的文件,然后在.gitignore添加了行1.txt Now, the uncommitted changes only include the change in .gitignore , and not the 1.txt . 现在,未提交的更改仅包括.gitignore的更改,而不包括1.txt After running git stash , this will stash changes in .gitignore and now you will see 1.txt appearing again as uncommitted change. 运行git stash ,这将.gitignore更改,现在您将看到1.txt再次显示为未提交的更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM