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.
Go to your desired changelist and expand into files. You can Ctrl+left-click multiple files, then right-click on one of them and select Move to another changelist... . You can also choose to Submit... the files, and when the dialog box appears, their will be checkboxes next to each file.
Set the active changelistIn the Local Changes view, select a non-active changelist and press Ctrl+Space or right-click it and choose Set Active Changelist from the context menu. All new changes will be automatically placed in this changelist.
Add files to VCSOpen the Commit tool window Alt+0 . Put any files in the Unversioned Files changelist under version control by pressing Ctrl+Alt+A or selecting Add to VCS from the context menu. You can either add the entire changelist, or select separate files.
In the Log view select the commit containing the changes you want to discard. In the Changed Files pane, right-click the file that you want to revert and select Revert Selected Changes from the context menu.
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'.
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).
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With