Git pre-commit hook configuration
Asked Answered
G

1

3

I'm following the office guidance to create and add a hook to the pre-commit check process. There are 3 files I need to create

  .pre-commit-config.yaml

  .pre-commit-hooks.yaml

   theCheckFile.sh

The config file configs the hooks file which calls the theCheckFils.sh file to check my code style.

Q.1 Where should I put those files? I currently put them into my project folder, and edit the .gitignore file to ignore all of them, any better suggestion? or this is OK.

Q.2 The rev is needed in pre-commit-config.yaml file, where should I find this information, there is not version information from the code Repo I'm currently working with, can I just randomly create a number?

Geer answered 18/2, 2019 at 16:35 Comment(0)
G
5

1) These files seem like project-root files to me (though I've never used this tool myself). I'd suggest putting them at the project folder to start with (likely next to your .gitignore file). Add them to .gitignore if you want to be the only person using pre-commit on your team, or add them to the repo if your entire team will be using pre-commit with the same settings.

2) It looks like the repo's rev field is 'the revision or tag to clone at' of the repo with the pre-commit check code. This would be used to identify which version of the check code to use, so it would likely be required. https://pre-commit.com/#pre-commit-configyaml---repos

Germanium answered 18/2, 2019 at 21:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.