有没有办法让忽略的文件在git状态下显示? [英] Is there a way to have ignored files show up in git status?
问题描述
有没有办法在Git中标记一个文件,例如git add。将不会阶段,但它仍然显示在git状态下?
我知道这听起来很疯狂,但原因是我有一些本地脚本文件,我希望在我的git GUI(塔)浏览窗口中看到,但是我如果我解开文件并设置状态showUntrackedFile = Normal(或全部),它们将显示出来,但随后他们通过git add重新加入。或舞台全部。如果我将它们放入.gitignore中,它们将不会被添加/分级,但它们也不会显示在浏览窗口中(至少在塔中是有效的git状态)。
有没有办法让被忽略的文件出现在git状态中?我猜不是,但希望切肉刀能够解决问题吗?
您可以创建别名,它调用 git status
和 git ls-files -o -i --exclude-standard
状态之后... 一种破解,但它应该起作用。
我刚测试过它,它的工作原理如下:
-
设置别名:
git config --global alias.st'!git status&&回声** IGNORED FILES **&& git ls-files -o -i --exclude-standard'
-
运行
git st
而不是git status
类似问题结果,
如何在别名中调用多个命令
Is there a way to mark a file in Git such that a "git add ." won't stage it but have it still show up under git status?
I know this sounds crazy, but the reason is I have some local script files that I'd like to see in my git GUI (Tower) browse window, however I don't want them added to the repo when I "stage all".
If I untrack the files and set status showUntrackedFile = Normal (or all) they show up, but then they get added back in by "git add ." or "Stage All". If I put them in .gitignore they won't get added/staged but they won't show up in the browse window either (which at least in tower is effectively git status).
Is there a way to get ignored files to show up in git status? I'm guessing no, but am hoping for a cleaver work around?
You could create an alias that calls git status
and
git ls-files -o -i --exclude-standard
after status...
Kind of a hack, but it should work.
I just tested this and it works
Set the alias:
git config --global alias.st '!git status && echo "**IGNORED FILES**" && git ls-files -o -i --exclude-standard'
Run
git st
instead ofgit status
Similar question
How to call multiple commands in an alias
这篇关于有没有办法让忽略的文件在git状态下显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!