简体   繁体   中英

Cannot commit file that is NOT inside gitignore file

I am trying to allow TeamCity do JavaScript code inspection by following this tutorial: https://blog.jetbrains.com/teamcity/2012/06/javascript-code-inspection-server-side/

The problem is that the first step tells me to Share Scope in WebStorm and then commit it to source control. I have .idea/* added to gitignore file but right underneath to NOT ignore .idea/scopes/* where the necessary .idea/scopes/JavaScript.xml lives.

So eventually it looks like this

.idea/*
!.idea/scopes/*

Even with this added to gitignore I still cannot commit my JavaScript.xml file. Has anyone came across this and knows how to fix/commit it?

It looks like the problem is with the !.idea/scopes/* bit because after running git status --ignored I can see .idea/ on the list

Try adding a slash before .idea

/.idea/*
!/.idea/scopes/*

git add -f .idea/scopes完成了这项工作

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM