Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove an item from the Intellij default changelist?

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.

like image 834
Sebastian Oberhoff Avatar asked Jul 05 '17 19:07

Sebastian Oberhoff


People also ask

How do I delete a file from changelist?

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.

How do I find the default changelist in IntelliJ?

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.

How do I add files to IntelliJ 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.

How do you remove files from Commit before push in IntelliJ?

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.


3 Answers

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'.

like image 86
marcel Avatar answered Nov 15 '22 04:11

marcel


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).

like image 45
matt helliwell Avatar answered Nov 15 '22 04:11

matt helliwell


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"
like image 39
JUAN CALVOPINA M Avatar answered Nov 15 '22 04:11

JUAN CALVOPINA M