git存储 - <文件>删除未跟踪的文件 [英] git stash -- <files> removing untracked files

查看:96
本文介绍了git存储 - <文件>删除未跟踪的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天在工作中,我的一位同事注意到,在提供文件路径的同时做一个git存储将删除未跟踪的文件。


$ b


git存储 - src /


该命令删除未跟踪的文件,并且在存储弹出后不会恢复它们。但是,


git藏匿

没有。



我看起来像一个bug。你能否解释一下这是否是正确的行为?当我尝试使用git stash -u时,它的工作方式如预期

解决方案

这实际上是一个bug,在由Thomas Gummerer酒店提交bba067d2faf047597bc76f885fb0cf87894b5ed1。这意味着你需要Git v2.16.2或更高版本来修复。所述错误已在提交df6bba0937209d679a06addd26975593fef744f2 时,这意味着GIT中v2.13.0或更高版本。

Today at work, one of my colleagues noticed that doing a git stash while providing the file path removes the untracked files.

git stash -- src/

This command removes the untracked files and does not recover them after stash pop. However,

git stash

this does not.

I looks like a bug to me. Could you someone please explain if this is the correct behavior ? This works as expected when I try git stash -u

解决方案

This was in fact a bug, fixed in commit bba067d2faf047597bc76f885fb0cf87894b5ed1 by Thomas Gummerer. This means you need Git v2.16.2 or later to have the fix. The bug was introduced in commit df6bba0937209d679a06addd26975593fef744f2, which means Git v2.13.0 or later.

(To avoid the bug, don't stash by pathspec. The stash-by-pathspec feature was new in Git v2.13.0, in the very same commit that has the bug.)

这篇关于git存储 - <文件>删除未跟踪的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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