vdudouyt
vdudouyt

Reputation: 936

.gitignore existing file without deleting it from repo

Can I tell Git to ignore changes in some tracked file when commiting a folder? So that, for example, if I decide to ignore 'private.conf', it wouldn't stage it for commit if I do 'git commit .', but it would be normally working if I explicitly tell it to 'git commit private.conf'.

Please also take in account that

Upvotes: 0

Views: 477

Answers (1)

Vampire
Vampire

Reputation: 38639

No, this is not possible. A tracked file is a tracked file and cannot be ignored.

Btw. using --assume-unchanged is rather dangerous, because you tell Git that his file is not changed and it will treat it like that, meaning Git can at any time discard you local changes if you switch branches, rebase, merge or similar.

If you want a files changes not being tracked, you need to delete it from the repository, like the suggestion with the .template file or .sample like I usually name such files.

Upvotes: 1

Related Questions