Domanda

I have a DB configuration file that is tracked by git. Since the DB on my dev machine has different attributes the file is always marked as changed and I need to remember not to check it in.

How can I make git stop following changes for this file?

NOTE: This is not the same question as the suggested duplicate. I asked about git ignoring changes in file and not files. git assume-unchanged is the right answer which is not mentioned in the duplicate.

È stato utile?

Soluzione

I think you are looking for the assume-unchanged flag of update-index - this will allow any local changes to a tracked file be ignored by git.

git update-index --assume-unchanged <file>

From the git-update-index man page

When these flags are specified, the object names recorded for the paths are not updated. Instead, these options set and unset the "assume unchanged" bit for the paths. When the "assume unchanged" bit is on, Git stops checking the working tree files for possible modifications, so you need to manually unset the bit to tell Git when you change the working tree file.

To undo the effect of above, use:

git update-index --no-assume-unchanged <file>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top