dafi
dafi

Reputation: 3532

How to prevent successive commit on specific file on git?

I have some configuration files to commit on GIT with default parameters. Users can pull these files and can modify them on their local copy but they must not commit/push.

How can I achieve a similar result? the file gitignore doesn't fit my need because file must be commit only the first time

Upvotes: 13

Views: 8738

Answers (1)

Mikael Koskinen
Mikael Koskinen

Reputation: 12926

Could you use git's "assume unchanged" function? If this is set, git always assumes that the file in question has not been modified. This means that git status, git commit etc. will skip the file. Please note that the user can still push a new version of the file into your remote repo but it will take some extra work to do that.

Here's a question where the usage of "assume unchanged" was discussed more thoroughly.

Upvotes: 9

Related Questions