How can untrack few files locally in git

git, version-control

Solution

Approach 1:

Do not commit files that should differ per developer. All of my config files (e.g. `config.yaml`) are in `.gitignore`; for each, I will have another file, (e.g. `config.yaml.template`), that would show the developers what they need to look like, which I would only edit when the structure changes.

Approach 2:

git update-index --assume-unchanged product/db.py product/prms.py

will let you change the files, and `git` will not commit them. If you do wish to commit them again, rerun it with `--no-assume-unchanged`.

Problem

I am working on project on my local machine. so i have different DB details, so i edited 2 files. ``` Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: product/db.py modified: product/prms.py ``` Now i don't want to commit it and want to ignore them locally so that no matter what i edit in those files they never gets pushed to remote repo I tried put them in `.git/info/exclude` Then i did `git rm --cached <file>` but then system is removing them Changes to be committed: (use "git reset HEAD ..." to unstage) ``` deleted: product/db.py deleted: product/prms.py ``` But i don't want to remove them as well How can i fix that EDIT: I don't want push anything to remote repo regarding that. i just want to ignore edits to those file from my compuer perspective only. so that when i got to office and then i make chnage in that file then it should work as normal. but from my home any edits should be invisible to git

Original source

Related problems