jb510
jb510

Reputation: 368

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 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?

Upvotes: 1

Views: 616

Answers (3)

manojlds
manojlds

Reputation: 301147

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

Upvotes: 2

Andy
Andy

Reputation: 46404

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

Upvotes: 1

JSager
JSager

Reputation: 1430

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.

Upvotes: -1

Related Questions