Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop tracking folder / files in git from IDE

Tags:

git

pycharm

I use PyCharm as my IDE and I love it. I use git as my version control system. I use it from within PyCharm (I don't know how to use it effectively any other way). Every once in a while, I will want to stop tracking a file in git. Whether I just don't want to track it anymore, or some .xml file somehow got added to the git list that always changes.

Is it true that there is no straitforward way to stop tracking a file or folder in git? The methods I have found seem like I am spending way too much time to do something that I would think should be simple?

First thing I always do is add them to the .gitignore file but that doesn't help after the fact.

like image 536
Brian Leach Avatar asked Jun 16 '15 20:06

Brian Leach


People also ask

How do I avoid tracking files in Git?

Use Git update-index to ignore changes To resume tracking, run the git update-index command with the --no-skip-worktree flag. Or, you can temporarily stop tracking a file and have Git ignore changes to the file by using the git update-index command with the assume-unchanged flag.

How do I remove a file from a Git track?

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.

How do I change tracked files in Git?

In this git gives a suggestion to the user that the tracked file on staging can be removed by using git rm --cached <file> . To practice the command, let's try removing the same CustomerData_IND. txt file, which was added earlier. To remove the desired file, type git rm --cached CustomerData_IND.


2 Answers

The two steps to stop tracking a file that you have been tracking are:

  1. Add the file to the .gitignore
  2. git rm --cached [file name]

I do not know how to do that from within PyCharm, however.

like image 147
Jer_ Avatar answered Nov 14 '22 23:11

Jer_


Open the Version Control tool window (Alt+9) and switch to the Local Changes tab. Click the Configure Ignored Files icon, and press the + sign to add files/folders that you want ignored. While this will work in the IDE, it is not the same as adding them in the .gitignore file.

like image 36
Paul Avatar answered Nov 14 '22 22:11

Paul