IntelliJ IDEA svn doesn't ignore .iml files - intellij-idea

In Settings-Version Control-Ignored Files, I have already specified the mask *.iml.
However, when I click on Commit Changes (Ctrl+K), .iml files still appear in the change list. In the right-click menu of one of these.iml files, I see the "ignore..." button is disabled.
How do I ignore these? It is annoying having to uncheck all these files every time I make a commit.

The blue color means Modified - so the files are already under VCS. And it is possible to ignore only unversioned files.
So what you need is to remove the files from VCS first (using git rm --cached, if you use git, svn rm --keep-local for svn, etc), commit the removal (BTW, be sure to do this outside of the IDE), and then they will be properly ignored.

Related

IntelliJ - cannot commit file

In IntelliJ, I cannot commit file (right click -> Subversion -> Commit File), the option is grayed out; however - it is possible to Update File.
As a workaround, I am able to commit the file through TortoiseSVN:
Could you help me to find out why is this happening?
I tried to configure project Settings -> Version Control:
And also, according to: Intellij Annotate Option Grayed Out
I tried to uncheck 'Use non-modal commit interface' but it didn't work.
It's not the best, but I found a solution to this problem, if I find anything else, I will definitely update.
From 'Version control -> Directory Mappings' I had to remove the Git repository, and leave only Subversion, then 'Commit File' works, but I can't in turn do anything (e.g. change branch) on the Git project (which is logical).
Then I cleared VCS log caches and indexes.
After that I re-added the Git project to 'Dependency Mappings'.
The problem is, I can't clear VCS log caches and indexes now, because 'Commit File' will stop working again (so again I'd have to remove Git, clear VCS, and add Git after that).
I'm guessing IntelliJ doesn't know which repository this 'Commit File' is for, so this option is greyed out. However, all options are now available.

PhpStorm automatically ignore files from .gitignore

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

IntelliJ: How to create a local Java project copy for backup?

I'm new to JavaFX 8 and the IntelliJ IDE. I have a JavaFX8 project that works but not as I would like. I'd like to try another approach but the substantial changes may not work. I don't want to loose code I have working.
To save code I have working, I've been creating a new project and then locally copying all the folders(.idea, out, src) and files except .iml, of the working project into the appropriate folders in the new project with the newly generated .iml.
This always seems to work but is it proper procedure?
I'm not on a team of developers and have yet to learn Git/GitHub.
Please advise. Thanks.
Maybe you should learn how to use a Version Control System like Git, then you can create a project repository and have different branches for things you want to try out. Keeping the working code in your master branch will prevent you loosing your working code. Also, when using a vcs you can always revert to versions of your code that have been working. The IntelliJ Idea IDE has perfect support for working with all different types of version control systems. If you don't want to learn any forms of vcs then there is no other way to "backup" your working code.
Is it proper procedure? It's probably not how most people would go about achieving what you want to achieve but it's certainly workable. If you wanted to stick with that for simplicity now, I'd copy the whole directory structure, delete the .idea and .iml files, and then create a new project in IntelliJ on that clean copy: IntelliJ will automatically set up folder structure based on the existing source without you having to go through any additional manual setup.
If you're willing to experiment with the git route, to achieve the basics of what you want to achieve is not very complicated and I've written a small quick-start below. IntelliJ offers very good support for Git, and once your repository is created you can do everything you need from the IDE. I'm going to assume you're working on Windows, although the steps shouldn't be too far removed on other platforms.
Install Git
You can download and install Git from https://git-scm.com/download/win, which will install a command shell called Git Bash.
One-off setup for your project
Open up git bash and go into the directory containing your source. Rather than seeing separate drives as Windows does, Git Bash assumes there is a logical 'root' directory under which all your files are accessible. Your C: drive will be /c. To move around you can use cd to change directory (using / instead of ) and ls to list files instead of using dir.
Assuming your source code is in C:\projects\myproject:
cd /c/projects/myproject
git init
The second line above creates a git repository in that directory. This doesn't affect your code, it just creates a folder called .git that contains all of the book-keeping information.
You don't want to have every file under version control - in particular you don't want your build outputs. You need to set up a file in your project directory called .gitignore which tells git which files and directories should be ignored. As a starting point you can copy https://github.com/github/gitignore/blob/master/Java.gitignore and rename the file to .gitignore
Basic Commands and committing your initial version
There are a small number of basic commands:
git status
Running git status will tell you which files have been modified, which are not under version control, and which files have been added to the staging area to be committed next time.
git add path/to/file
This adds a file to the staging area waiting to be committed. You can add multiple files to the staging area before committing them in one go.
git commit -m "description of your change"
This commits all of the staged files as a new version, which the specified commit message.
If you go into your project directory, do a git status and check through the list to make sure there's nothing you don't want to have under version control, then you can do git add . to add everything to the staging area and git commit -m "Check in initial version of the source code" to commit it to the repository.
After you've committed, you can run
git log
To see a history of all of the changes. IntelliJ has a view that will show you the same thing.
Creating an experimental branch
This is where git shines; if you want to try something experimental you can create a branch of your project while allowing git to preserve the original version.
git checkout -b experiment1
Will create and switch to a branch called experiment1. You can delete, rename, move, rewrite and develop whatever you like on this branch. The changes you commit will be independent of your original working version.
You can switch back to your original version (preserving all of the changes you've committed on that branch) using:
git checkout master
Where master is just the name of the default branch created when you ran git init. The experimental version will still be there and can be switched to again using git checkout experiment1 or from IntelliJ using the branch selection in the bottom right corner of the status bar.
If you decide that the changes you've made in experiment1 are to become your new "good" version, you can merge them back into the master branch and repeat the cycle from there.

Unshelve in IntelliJ IDEA 12.1.3

I've recently updated IDEA and now can't find neither unshelve feature, nor shelves view. Where are they?
Shelving works fine, I see patch file. But the only way to restore it is to take this file from IDEA secret folder and perform "Apply patch" with it. Is it OK?
Often after an upgrade (especially when you install to a different directory) IDEA loses its index of what patches were on the shelf.
Thankfully, the patch files are still there - IDEA just doesn't remember about them any more.
Look in your .IntelliJIdea/config/shelf directory and you should find some .patch files (each one named after with the name of the changeset that you shelved).
You should be able to "Apply Patch" these files from your CVS menu like normal patch files (that's all shelve/unshelve does anyway, nothing fancy going on - I've done it before and it worked fine).
If you haven't changed anything about your installation, the .IntelliJIdea directory should be in your home directory (not sure, I always change mine to sit underneath my IDEA install directory).

UserInterfaceState.xcuserstate not getting committed while using git in Xcode

when I'm trying to commit my code project it shows a file called 'UserInterfaceState.xcuserstate' which has to be committed. once i commit it and try to push my project to git ,the Xcode gives me a popup message saying that 'The working copy "app" has uncommitted changes.' and when I try to commit again I get the same file 'UserInterfaceState.xcuserstate' to be committed again. Can anybody help me with this?
UserInterfaceState.xcuserstate is where Xcode saves your GUI states, such as window positions, open tabs, expanded nodes in the project inspector etc.
Simply resizing the Xcode window will cause this file to change and be flagged as modified by your source control system. You can make your SCM system ignore specific files that are not important to the project itself.
You want Git to ignore the file, you can add it to the .gitignore file, but you have to remove the tracking. To stop tracking a file that is currently tracked, use git rm –cached.
git rm --cached ProjectFolder.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterfaceState.xcuserstate
git commit -m "Removed file that shouldn't be tracked"
Afterwards the .gitignore will take effect of UserInterfaceState.xcuserstate
Now onwards you wont get a popup message saying that 'The working copy "app" has uncommitted changes.'