Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove a folder from version control (but not delete it) using Intellij IDEA?

I'm aware that I can just copy the files someplace, delete the (svn) controlled stuff and move the files back. But this seems like an easy task to automate in the IDE, so... am I missing something? Can I just "unmark" a directory so it gets deleted from VCS but kept on-disk and how?

like image 790
mabi Avatar asked Nov 08 '13 12:11

mabi


People also ask

How do I delete a folder in IntelliJ?

Select an item you want to delete. Select Refactor | Safe Delete from the main or context menu or press Alt+Delete . In the dialog that opens, select necessary options and click OK. If IntelliJ IDEA encountered potential problems, it displays the Usages Detected dialog.

How do I Untrack a file in IntelliJ?

In IntelliJ open the Version Control Tool Window. In the Local Changes tab: create a new change list (do NOT make it active) You can add all the files you would not want to commit to this new changelist. Commit and push only the other changelist(s)


3 Answers

As this is a unusual use case, there is no direct way to do this. This is assuming the directory in question has indeed been committed and not just added. An added but not yet committed directory can be reverted/rollbacked.

A way you can do this within IDEA is as follows:

  1. Delete the directory
  2. Commit to VC
  3. In the Project view (or the Navigation Bar), open the context menu on the parent directory of the directory you just deleted and select Local History > Show History
  4. In the local history dialog, select the "Deleting" action (should be the top one) and click the Revert button.
  5. If you get an "Add files to {VCS Name}" dialog, just hit cancel
  6. Close the local history dialog.

Your directory has now been removed from VC but is back on your file system.

Edit:

If this is a common occurrence for you, you can record this in a macro (Edit > Macros). Use the left arrow to move to the parent directory for step 3. You can then map the macro to a shortcut in Settings > Keymap

like image 196
Javaru Avatar answered Oct 19 '22 23:10

Javaru


If you only added the directory to SVN(without commit), just Revert it and it will be unversioned.

If you already committed the directory into SVN, in Intellij:

VCS > Browse VCS Repository > Browse Subversion Repository....

It will open the repo browser, then:

right click on folder you want to delete > Delete... > Commit

like image 40
100ferhas Avatar answered Oct 20 '22 00:10

100ferhas


  1. Right click on the parent folder of your folder and click on "Open Terminal"
  2. type svn rm --keep-local your_folder
  3. Wait 10 seconds until IDEA has noticed the deletions
  4. Commit
like image 1
bb1950328 Avatar answered Oct 19 '22 23:10

bb1950328