Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Status - How to exclude unwanted folder's content to be shown when I execute 'git status' command

I'm trying to avoid showing unwanted folder's content (ex:- .settings, .metadata etc ) when i execute git status command.

I modified .gitignore file after adding the folder names to it but still I'm getting all these files when I execute git status.

like image 494
Raj Avatar asked Jan 17 '17 15:01

Raj


2 Answers

Run this from the git project directory, where dir is directory you want to exclude.

git status . -- ':!dir'

For your example if want to exclude multiple directories (e.g. settings and metadata).

git status . -- ':!settings' ':!metadata'
like image 151
wizzfizz94 Avatar answered Sep 19 '22 19:09

wizzfizz94


According to the git glossary pathspec, if you want a quick peek on the changes made to all the folder other than **/settings/, here is how

git status ':(exclude,top)**/settings/*' ./
like image 41
zyy Avatar answered Sep 18 '22 19:09

zyy