shell - staging all files except specific files using glob patterns in git -


i trying stage new created files , others edited files staging area in git using git add command. want stage except *.java files (in current directory , in every sub directory in project). tried work no success.

pwd: /d/myproject

nothing of these worked:

git add !(*.java) git add \!\(\*.java\) git add \!\(*.java\) git add !\(\*.java\) 

could me work please? , somehow possible use regular expressions instead of globs here?

you use find:

find . -type f ! -iname '*.java' -exec git add {} + 

you can skip paths matching pattern using ! -ipath <pattern>, e.g:

find . -type f ! -iname '*.java' ! -ipath './a/b/*c*' -exec git add {} + 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -