# "git checkout" obliterates not-yet-ignored files

1 messages from 2018-11-04 to 2018-11-04. Participants: Matthias Urlichs.
Thread: https://gitlist.dev/t/49757

## Matthias Urlichs, 2018-11-04 19:29

Subject: "git checkout" obliterates not-yet-ignored files
Message-ID: <949b99d6-c681-49ed-4a4e-d33e0f6487d3@urlichs.de>
URL: https://gitlist.dev/e/949b99d6-c681-49ed-4a4e-d33e0f6487d3%40urlichs.de

```
Hi,

the problem: suppose I decide that a local file should no longer be
controlled by git. Thus I add it to .gitignore and then "git rm
--cached" it. So far so good.

However, if I subsequently modify that file and then go back to a commit
that still contains it, my local changes will be obliterated.

IMHO that's a bug – .gitignore should only be used for (not) adding
non-version-controlled files. It does not tell git to ignore changes (in
files that *are* under version control), and thus it should not allow
any git command to simply overwrite a file.

-- 
-- Matthias Urlichs



```
