BLaZuRE
BLaZuRE

Reputation: 2406

Possible to send a warning about a (specific) changed file in Git?

I have a file which needs certain lines for the production server (and those lines to be commented out on the backup server and personal boxes). Since it doesn't seem possible for Git to exclude certain lines from a file, is there a way to issue some kind of warning to users that will notify them certain lines need to be uncommented when pushing to the production server?

Upvotes: 1

Views: 346

Answers (1)

jdd
jdd

Reputation: 4336

Yes, a pre-receive hook is probably what you want. They're just executable files, exit non-zero to cancel the push. See git help hooks

This seems like the type of thing that would be most appropriate for a pre-commit hook, however that would require some manual setup (at the least a symlink) for each fresh clone. If that wouldn't be an issue, it would probably be preferable to making people either rewrite commits when they forget or clutter your history with changes to those lines.

Upvotes: 1

Related Questions