13

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

1
  • 2
    There's no way to enforce this with git. You're best bet is probably to follow the .config.template or .config.defaults pattern outlined here: stackoverflow.com/questions/1396617 . It's the most common approach to managing configuration files in source control. It's not a git specific approach. Commented Aug 16, 2010 at 9:08

1 Answer 1

9

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.

Sign up to request clarification or add additional context in comments.

1 Comment

But how can I force people to not suddenly commit some file? For example I'm writing integration test and everybody should edit config to match local environment. And I want to prevent these changes condif to suddenly be pushed on the server instead of templates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.