开发者

Is there a way to have ignored files show up in 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 i开发者_如何学运维n 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?


I am not sure if the other answerers are reading the man, but:

git status --ignored

shows ignored files as well.

http://www.kernel.org/pub/software/scm/git/docs/git-status.html


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 of git status

Similar question
How to call multiple commands in an alias


I don't think so; that would actually break the intent of git ignore.

From http://git-scm.com/docs/gitignore

A gitignore file specifies intentionally untracked files that git should ignore.

I know it's probably not the answer you're hoping for, but I think it's accurate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜