Intellij is "ignoring" in various ways, my dist folder suddenly
Files in my ‘dist’ folder (in the root) are treated as ignored in git terms and as excluded in Intellij terms. Git never tries to commit them. This is new and did not happen before. I recently moved from a Windows 10 machine to a new Mac and changed from Windows Intellij to the Mac version.
So I didn't have one of my other repos loaded on the new mac. I used “git clone” to download a different app from a different repo than the one I was having ‘dist’ ignored in. In the new repo, newly loaded into Intellij as a project, the new ‘dist’ folder shows as Excluded in the Intellij UI. The Project pane has the litle orangish box over it and the 3 files inside. (Just like it looked in the old repo.)
There are 3 files in the dist folder now. There were 3 files in the dist folder when I loaded it.
The 3 files are javascript stuff and are now newly changed, having just been rebuilt from new typescript code.
.gitignore in the repo root does not contain the ‘dist’ folder (or any wildcard that references it.
The “commit” pane does not show the changed files in the “changes” section nor in the “ignored files” section. Other changed files show up in the ‘changes’ section and other folders from .gitignore show up in ‘excluded files’ section. (.gitignore is listed below but ‘dist’ is not in it.)
If I right-click on the “dist” folder in the Project pane and choose “Mark Directory As…” > “Not Excluded”, the orange box does not go away in the Project pane. The files don't show up in the “commit” pane (anywhere). I can repeat clicking “Not Excluded” multiple times and it changes nothing.
If I go to “file” > “project structure” > “modules” > “sources” (at the top) it shows “dist” in the tree section with a folder icon with a star (*). The right section shows the Content Root as the root of the repo. Under it is “Sources” and it includes “dist [generated] …..”. Previously it showed “dist” as excluded at the bottom of this section but I deleted it from there to try and get rid of the orange box. That did not work. I also did something that changed ‘dist’ to being “generated source” but that didn't change anything about being able to commit the ‘dist’ folder contents.
In Intellij terminal I get:
% git status --ignored
... <skip some lines>
Ignored files:
(use "git add -f <file>..." to include in what will be committed)
.husky/_/
coverage/
node_modules/
no changes added to commit (use "git add" and/or "git commit -a")
557631@AC01687 /Users/557631/work/actions/dte-analyze-pipaudit-action [main]
% cat .gitignore
**/node_modules/
contexts/
**/coverage
tsc/
/test/config/local.json
**/.DS_Store
**/.vscode/**% 557631@AC01687 /Users/557631/work/actions/dte-analyze-pipaudit-action [main]
% git ls-files --others --ignored --exclude-standard
<shows lots of files but non in the dist folder>
So, I am confused. I am seeing these things:
1) Intellij will not add the dist content into the git list of things unstaged, things staged or things it can commit. It does not commit those files as well.
2) Git status does not show the dist content whether I do it from the Intellij terminal pane or from the Mac Terminal app.
3) ‘ls -al dist' shows the 3 files as having been changed today. That is later than the date of “git log” latest commit. This may not matter as I downloaded the repo today. I don't know if git clone causes the files to have their last commit date or just uses the download date.
4) I cannot push the new files to my git (github) remote repo. This true, now, but not previously, for files in dist.
Please sign in to leave a comment.
I found a lot of what is confusing about this. It doesn't seem to have anything to do with git because I was building some unfinished typescript code and the starting point for the compile wasn't calling any of the new code so it got optimized out and a build wasn't actually changing the dist folder.
But the problem with the dist folder being set as a separate “Context Root” and then marked to exclude is a problem. For some reason, using “Open” to load a newly cloned repo into Intellij, sets it up that way. Is there a config that does that on the new Mac?
“So I didn't have one of my other repos loaded on the new mac. I used “git clone” to download a different app from a different repo than the one I was having ‘dist’ ignored in. In the new repo, newly loaded into Intellij as a project, the new ‘dist’ folder shows as Excluded in the Intellij UI. The Project pane has the litle orangish box over it and the 3 files inside. (Just like it looked in the old repo.)”
What is the exact project structure?
Does the project already have a .gitignore file and what is the content?
If you make a new clone with git, is the situation the same?
Can you share some screenshots?
Dino
In my original post I listed my .gitignore. And I also said I got the problem with a new clone.
Are you thinking a 2nd new clone on my new laptop would work different than the first one with this repo? Or would it work different than the 1st new clone with the other problem repo?
Please explain what you want to know about the project structure. The dist folder is in the root of the repo. It had files in it when I first cloned it. Then running an npm script rebuilt those files and those changes were ignored because the settings created the new dist folder as “excluded”.
Where exactly is the project located?
Yes, will the second clone behave the same?
Can you share the screenshot of project structure (CMD + ,) or in File