I'm having a tracked file in git but now I don't want to track it anymore (I don't want it to show up from the next commit but I still want to have it inside the folder).
In the Changes
tool window I have set that file as ignored
in Configured Ignored Files
but somehow when I change that file, the changes still shows up in the change list?
Removing Files To remove a file from Git, you have to remove it from your tracked files (more accurately, remove it from your staging area) and then commit. The git rm command does that, and also removes the file from your working directory so you don't see it as an untracked file the next time around.
Given your project is linked to a git repo already, you can just use the standard IntelliJ feature to "delete" the file. In the project pane, focus the file and hit Delete key. The "Safe Delete" popup will appear, click OK .
Press Ctrl + Z to undo the removal of the file. If IDE shows a popup window which lets you choose whether or not to add the new file to VCS, click No . Commit your local changes, and the files are removed from VCS.
The git rm command can be used to remove individual files or a collection of files. The primary function of git rm is to remove tracked files from the Git index. Additionally, git rm can be used to remove files from both the staging index and the working directory.
As of 2017.3.4, you cannot use the IDEA GUI to perform this command, it must be done from the command line or another tool.
From console:
git rm --cached file git commit -m'file removed' echo 'file' >> .gitignore
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