Reputation: 1301
Somehow or other a file in the .idea
folder has landed on the default changelist and every time I make a commit Intellij is asking me if if I want to include the file in the commit.
I can't figure out why Intellij insists on trying to version control this file or how I can change its mind.
Upvotes: 8
Views: 9568
Reputation: 407
Seems a bit counterintuitive but to remove a 'new' file from Default changelist (shown in green -> versioned) you simply need to revert the file (with option of not actually deleting the file from the file system -> which is an option in the revert popup). This way it will be removed from the Default changelist and from vcs, showing up in red as an unversioned file.
With this you can toggle between versioned and unversioned.
Ignoring the file (in your versioning configuration or in intellij) is obviously the thing you want to do to make it not show up anymore as a possible candidate for commit. Just wanted to make the clear difference between 'ignoring' and 'toggling between versioned and unversioned'.
Upvotes: 10
Reputation: 2678
Right click on the file in the version control window and select "Ignore...". Then select the relevant option (ignore file, directory or all files matching).
Upvotes: 2
Reputation: 3955
From bash console write git status
this action will display all files modifieds/new, now identify the file of .idea
folder, if the file is untracked then you just delete that file with the following command:
git clean -f .idea/file_to_include.xml
But if the file has changes git can undo the change with the following command:
git checkout -- .idea/file_to_include.xml
In spite of the proposed solution, it is advisable to avoid tracking that folder as well as some files like *.iws, *.iml, *.ipr
, for to do that, you can create a .gitignore
file in the main folder of your project and add this:
.idea
*.iws
*.iml
*.ipr
save the file and add it to your repo:
git add .gitignore
git commit -m "Excluded files and folders"
Upvotes: 1
Reputation: 462
You should create a .gitignore file that tells git and intellij to ignore the .idea folder
Upvotes: 0