I have setup a local git on my machine. When I initialized git, I added pre-compiled libs and binaries. However, now during my development I don't want to check in those files intermittently. I dont want to remove these files from repo. Is there any way to not keep a track of these files till I complete my development. (I think I can not use .gitignore as it works only for those files which are not in git. I want to temporarily disable tracking of 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.
Usually, you want to clear your Git cache because you added new entries in your gitignore files and you want them to be taken into account. The easiest way to clear your Git cache is to use the “git rm” command with the “–cached” option. You can choose to remove one file or to remove an entire working directory.
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.
git update-index should do what you want
This will tell git you want to start ignoring the changes to the filegit update-index --assume-unchanged path/to/file
When you want to start keeping track againgit update-index --no-assume-unchanged path/to/file
Github Documentation: update-index
you could keep your files untracked after
git rm -r --cached <file>
add your files with
git add -u
them push or do whatever you want.
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