[Feature request] Remove file from version control

Answered

Hi,

With this post I would like to submit a feature request.

It would very usefull if a user could select one or more files, and choose to remove them from the version control system, leaving the file(s)/folder(s) intact on the local file system.

This could be very usefull in the project window, as well as in the "Version Control" tab.

Thank you.

 

11 comments
Comment actions Permalink
Official comment

Hello Tim,

Thank you for the feedback, however I would like to note that we already got such requests and they were declined.

Check this one, for example: https://youtrack.jetbrains.com/issue/IDEA-107359

The idea behind this is that we try to support common workflows, while removing files from VCS tracking without actually deleting it is relatively rare operation, and you can do this using the command line or terminal within IDEA.

 

 

Comment actions Permalink

well. I just imported an old Java project and when I went to add the source folder to Git, I discovered that Intellij had added every since folder and file to Git tracking. We are talking build scripts, shell scripts to help with build, configuration files, compiled .jar and .class files...everything. I wasn't prompted to add these items every though in settings->versions I have "ask for each file" checked. 

can we at least get a link to procedures to remove files from tracking from the command line using git? 

0
Comment actions Permalink

To stop tracking files in git (remove from git but keep locally), just execute git rm --cached path/to/file, Make sure to commit such deletion from the command line as well.

1
Comment actions Permalink

Dmitri - I did that, but I had to open a terminal and execute the command multiple times for directories and files to remove undesired items.

It would be more efficient to select the same files and directories in the app, right-click, and select "remove from tracking" or similar.

0
Comment actions Permalink

What is the use case of removing the files from VCS?

If it is to ignore them, there seems to be a better way to support this - as a part of ignore functionality,  e.g. https://youtrack.jetbrains.com/issue/IDEA-57620 or https://youtrack.jetbrains.com/issue/IDEA-21006

Any other use-case?

0
Comment actions Permalink

The use case was that I had an existing non-PyCharm project that I imported into PyCharm. It was structured for Maven as per the standards of a previous development team, where it had folders for build , deploy, artifacts, etc, all underneath the parent directory. PyCharm added all of the those files to the the repo in addition to the "src" folder which contained the source code. 

I was looking for an easy way to undo that mistake. By the way, PyCharm did not indicate that it was adding anything to version control, no prompts, no warning, nothing, 

0
Comment actions Permalink

The mentioned action is needed only for committed files. If files were added for commit by mistake, but not committed, you could just Revert the addition.

You could also Undo the entire commit unless it has been pushed, and then commit again with the correct set of files.

IDE adds files to VCS automatically only if the corresponding option is enabled at Settings - Version Control - Confirmation, and files were created in the IDE. Since it is a maven project, maven import could have affected this somehow - see related https://youtrack.jetbrains.com/issue/IDEA-18710.  However, all changes (additions, deletions, modifications) are shown in the Local changes tab, and subsequently in the commit dialog. So you always see what you commit, and could unselect or revert files you do not want to commit.

Moreover, with the way IDE commits currently (using git commit --only) it is not possible to commit deletion from VCS without deleting the file itself. See https://youtrack.jetbrains.com/issue/IDEA-138847

 

0
Comment actions Permalink

Adding this feature would be a huge improvement. If the commit of the deletion results in the selfdestruction of the file on the local file system, just backup the file to a local temporary location, and restore the file after the commit was pushed... Just a simple fix i think ... :-) 

0
Comment actions Permalink

The issue with committing of such a change is not primarily the reason for not adding this. Please see the reasoning in https://youtrack.jetbrains.com/issue/IDEA-107359

Why would you need to stop tracking a file and at the same time leave it as untracked, without ignoring?

0
Comment actions Permalink

Any progress on this very very useful feature? 

1

Please sign in to leave a comment.