本文介绍了在混帐中,有没有办法显示未经跟踪的隐藏文件而不应用隐藏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我运行 git stash -u ,我可以存储未跟踪的文件。但是,根据 git stash show stash @ {0} ,未跟踪的文件完全不显示。有没有任何方法可以显示未跟踪的存储文件而不应用存储?

解决方案

未跟踪的文件存储在存储的第三个父级承诺。 (这实际上没有记录,但是从短语的事情......或者只是通过做 git log --graph stash @ {0} )



您可以通过以下方式查看存储的未跟踪部分:

  git show stash @ {0} ^ 3 

或者只是未跟踪树本身,通过:

  git show stash @ {0} ^ 3:

或树中特定的未跟踪文件,通过:

  git show stash @ {0} ^ 3:其中路径/到/文件> 

不幸的是,没有办法总结所有分阶段+非分段+未跟踪vs当前状态。即: git show stash @ {0} 不能包含未跟踪文件。这是因为存储提交本身的树对象(称为 stash @ {0}:)不包含来自第三个unstaged父级的任何更改。
$ b 这是由于存储过程被重新应用的方式:被跟踪的文件可以很容易地作为补丁应用,而未被跟踪的文件只能在理论上被应用为整体文件。


If I run git stash -u, I can stash untracked files. However, said untracked files don't show up at all with git stash show stash@{0}. Is there any way to show untracked stashed files without applying the stash?

解决方案

Untracked files are stored in the third parent of a stash commit. (This isn't actually documented, but is pretty obvious from The commit which introduced the -u feature, 787513..., and the way the rest of the documentation for git-stash phrases things... or just by doing git log --graph stash@{0})

You can view just the "untracked" portion of the stash via:

git show stash@{0}^3

or, just the "untracked" tree itself, via:

git show stash@{0}^3:

or, a particular "untracked" file in the tree, via:

git show stash@{0}^3:<path/to/file>

There is, unfortunately, no good way to get a summary of the differences between all staged+unstaged+untracked vs "current" state. ie: git show stash@{0} cannot be made to include the untracked files. This is because the tree object of the stash commit itself, referred to as stash@{0}:, does not include any changes from the third, "unstaged" parent.

This is due to the way stashes are re-applied: tracked files can be easily applied as patches, whereas untracked files can only be applied, in theory, as "whole files".

这篇关于在混帐中,有没有办法显示未经跟踪的隐藏文件而不应用隐藏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 16:32