PhpStorm automatically ignore files from .gitignore - ide

I'm new to PhpStorm, and I'm trying to get it to automatically ignore files specified in my .gitignore file when adding a file tree to git. I know you can add ignore rules to PhpStorm itself, but I want it to use the rules from my .gitignore file.
Basically I already have a .gitignore file with ignore rules, I just want PhpStorm to follow those rules when adding files (git add) so that none of the files matching the .gitignore rules will be accidentally added to a commit.

I know in the past this has happened to me as well, so it seems a bit fragile. I never do a git add for the entire directory since it has done things like add files in the /vendor directory (which is always in the gitignore file).
But having said that, I was curious, so I did a test as I think it might be related to when things happen (like when git is engaged, or when the .gitignore is added).
I did the following steps on a new project and it worked appropriately, so maybe that will help, you can give it a try and see if it works for you as well. I am working with 2016.1.2
Create the project
Select VCS...Enable Version Control Integration and select Git
Create the .gitignore in the root directory
In the project, create a new directory called ignore
In the .gitignore, add ignore/ and the ignore directory should turn light gray
Create a.txt in the root directory
create b.txt in the /ignore directory
right click on whole project and select git add and b.txt under the ignore directory is not added, but a.txt is

Related

Nuxt - Purpose of README.md in each folder in the default project structure

I wonder why there is a README.md in every folder in the default project structure. Is it intended to keep it?
Answer from the Nuxt Discord: Create-nuxt-app only recently made git optional, but it was automatically added previously. AFAIK git can't track empty directories, thus they used README.md to mitigate this. Other solutions I've seen are creating files like .gitignore or .gitkeep inside a empty directory to ensure the empty directory is tracked/commited. It can be any name, but gitkeep seems to be what people gravitated to, yet I never did this personally.

AccuRev is ignoring my .acignore file

I have an .acignore file that looks like this:
**\build
**\build\**
**\.gradle
**\.gradle\**
My file structure is as follows:
AccuRev Workspaces
.accurev
Workspace1
Workspace 2
I placed my .acignore file into the .accurev folder under AccuRev Workspaces and restarted AccuRev. It didn't start ignoring any of the files that I expected it to (and they are all external). I then put it directly under the AccuRev Workspaces folder and restarted; still no luck. I even put it in both of those places under an individual workspace and it didn't work. I'm at my wits' end. What is going on here????
The .acignore file must be in the workspace top directory. In other words, you would need an .acignore in the Workspace1 directory and another in Workspace2. This allows you to have different ignore rules for each workspace. Alternatively, you could add it to source control if you have standard ignore rules applicable to all workspaces.

Force IntelliJ to use another Home Directory?

I have read this... it does not answer the question.
I would like to have IntelliJ use another location for all of my project files. Currently, it goes to c:\users\ as a default project location.
I want to change that to c:\git.
I tried to change the "Start in" link properties, to no avail.
I don't want to force all of the configuration (ie: the .IdeaIC15 folder) to be relocated, I just want it to go to c:\git when I click "Open project".
To change the directory where project files are located to C:\git:
Select Help->Edit Custom VM Options...
Add the following line to the end of the file that comes up in the editor (*):
-Duser.home=C:\git
Restart IntelliJ.
(*) The file that comes up in the editor will either be idea64.exe.vmoptions or idea.exe.vmoptions.
Notes:
This will update/create a .vmoptions file in your config directory. It does not modify the vmoptions file in your install directory.
The above steps do not change the default directory that is used
when cloning git repositories. This is the directory that is used in
the File->New->Project from Version Control->Git window. You
still need to set that directory to C:\git and clone one remote repo
into C:\git. Once you have done that IntelliJ remembers the directory and
uses it for subsequent clones.
https://intellij-support.jetbrains.com/hc/en-us/articles/207240985-Changing-IDE-default-directories-used-for-config-plugins-and-caches-storage
Locations can be changed by editing the following file:
IDE_HOME\bin\idea.properties
Follow the comments in idea.properties file to change the defaults, make sure to un-comment the lines defining these properties:
idea.config.path
idea.system.path
idea.plugins.path
idea.log.path

In IntelliJ, How Do I Fix "These Files Do Not Belong to the Project"?

I recently put several old, yucky git directory structures into one new, clean structure in SVN, then pulled the entire SVN repository back out into a new, clean, local git repository. One IntelliJ project was so messed up I had to import the old IntelliJ project, which created a new .iml file having a better name, and deleted the old .iml file. I reconfigured everything, committed back into SVN, and verified other people could open the project and build.
Today I tried to edit a file for the first time in this project and got the message, "These files do not belong to the project". IntelliJ offers to unlock the file or all non-project files in the current session, but both options sound wrong. What have I done to myself, and how do I fix it?
This happened for me when I ignored the .idea/ files. Just do
rm -rf .idea/
And then File -> Invalidate Caches/Restart -> Invalidate And Restart.
I figured out the problem. The file was still open from before all the shuffling, and was apparently pointing at the original file in its original location! I closed the editor and reopened the file from the project tree without a problem. I hope this helps someone else someday.
From File-> Repair IDE -> Rescan Project Indexes -> Reopen Project worked for me.
Had same problem on Ubuntu (Webstorm), got answer from Intellij.
There are no content roots in your project, so all your files are
treated as non-project files. As I wrote your .idea files are likely
broken, the .iml file and/or modules.xml are either missing or
corrupted. Deleting and re-creating .idea folder should help:
-close the project
-remove it from Recent projects list
-shut down the IDE
-delete the .idea folder
-restart, open the project root folder with File > Open
https://intellij-support.jetbrains.com/hc/en-us/requests/3779670?page=1
This also happened for me when I opened the project through a symlink (parent directory) or when the python interpreter was inside a symlink directory (because of virtualenv).
Reopening through the original directory tree (after fighting hard with the IDE to forget its beloved project settings), solved the issue.
It's probably listed in one of the XML config files in .idea/*.xml.
Just do a find of that folder for the name of the file in question, and remove the entry for it from the XML.
Mine was listed in .idea/workspace.xml within the following node: <component name="TypeScriptGeneratedFilesManager">.
I removed the option, then invalidated caches and restarted, and now the file is marked as a standard, non-generated file again. This way you can keep all your settings without exporting them and importing them.
Similar issue with WebStorm. The difference was I had to shutdown the IDE completely and then remove .idea folder
rm -rf .idea
I tried doing it with the IDE open and going to file File -> Invalidate Caches but that did not fix the problem for me.
Same problem. File was considered not part of the project even if I deleted it and created a new one with the same name.
To fix,I highlighted the project node in the left panel, selected "File/Invalidate caches and restart" from the top menu.
After the restart I had to set my file as a JS file (right click, set as JavaScript), close and reopen the project. All fixed.
For me the above did not help. I ended up going Project Structure -> Modules -> + at the top narrow middle column -> browsed through files to select the Project Folder -> apply -> ok -> all is done and working correctly.
My problem was much simpler than expected: I was trying to run a Jupyter notebook and got the error - because it was inside a folder that was marked "excluded" in the project structure.
Simply moving the notebook out of the excluded folder solved my problem.
In my case it was auto-generated .gitignore, I had entries like:
### npm ###
node
node_modules
frontend-dest
data/
And in project files I had java package called like com.company.test.data which matched last pattern. I strongly recommend to check it before removing .idea/ files and invalidating cache.
This warning is an IDE issue that Android Studio cannot recognise the current directory if it does not include any source files.
So, adding am empty source file, e.g empty_xxx.c under the directory in question and adding below line in CMakeList.txt
add_library(${TARGET_NAME_XXX} SHARED ${SOME_DIR_HAVING_THIS_WARNING}/empty_xxx.c)
will help get rid of this warning.
In my case the above methods didn't help, I just deleted .idea file in project and reset the Jetbrain IDE to default settings and it worked normally.
NB: You will loose all your settings and plugins, but if you don't mind this might help as the last resort like in my case.
I am using Jetbrain,
make sure to include all project files in the project. Use Settings -> project structure.
PyCharm > Preferences > Project > Project Structure > Add Content Root
Somehow PyCharm lost the project root directory in my case
For me it was because I had moved a project to wsl by copying the files from wsl to windows. When I switched branches the file must've been open from before and was the windows version of it and not the wsl one.
I noticed this finally by looking on top of the file tab and seeing the path as C:\User...\filename instead of \\wsl$....\filename.
Close your JetBrains IDE, then open a Terminal window and navigate to your project's root folder, and run these 2 commands:
rm -rf .idea
and then
rm -rf .git
NOTE: you'll probably have to connect your project back to your git repository, so if you have any uncommitted changes make sure to commit and push them beforehand to avoid losing them.

Git and XCode: Merging .xcodeproj gives binary warning

I am working with branches and wanting to merge with my master, but the files inside of my .xcodeproj are causing huge issues.
Constantly getting errors about overriding them, that they are binary files, etc etc.
What do I need to do to never have to worry about this? It is driving me nuts!
NOTE: I have a .gitignore file in my master that ignores these files, but not in my branch. Not sure what to do about that.
In the root of the project (eg, same directory as .git), add a git ignore file
.gitignore
With a line that says
.xcodeproj
Then remove the .xcodeproj file from the repo...
git rm --cached /path/to/.xcodeproj
Then add the .gitignore file
git add .gitignore
Then commit
git commit -m "Removed .xcodeproj; added ignore pattern to excluded it"
You can use a .gitignore file to specify that file to be ignored by git.