-1

Excuse the fairly simple question, but I'm a Git newbie. How do I force a developer to make a change to a file that is associated to the 'parent' file that he/she is changing/committing? We are a Windows shop using GitLab, SourceTree and TortoiseGit.

sid
  • 1
  • 2

1 Answers1

0

You add a pre-receive hook to the GitLab repository where he pushes to. In the script you can validate all newly pushed commits to make sure the commit contains both files or none of them. If the script fails, the push is aborted and the dev has to fix his commit first.

Vampire
  • 35,631
  • 4
  • 76
  • 102
  • Thanks, this is what I thought should be done. What is the difference betwween this and a pre-commit hook? – sid May 11 '17 at 10:51
  • `pre-commit` is for committing. Committing is a local operation at the developers local repository. You would need to place this hook manually on each new clone and the developer can disable (or ignore with parameter) this hook at any time if he wants. The `pre-receive` hook is on the remote repository where they push to and should be used for enforcement of certain rules. You can make a pre-commit hook additionally of course, but as I said, it has to be placed on each new clone manually and the developer can disable its usage at any time. – Vampire May 11 '17 at 13:13