Hooking the Test into Git: Working of Git
Explore how to create and use Git hooks such as pre-commit and pre-push scripts to automate testing and enforce coding standards. Understand how hooks can reject commits that fail conditions and how they fit into project workflows for robust code management.
We'll cover the following...
We'll cover the following...
Create scripts
Let’s make two simple scripts to show how git hooks work. The first one will be named .git/hooks/pre-commit. Do not include the .sample suffix or any other suffix. In the file, add these lines:
#!/usr/bin/env python
print('Hello from pre-commit')
Make a similar file with a different string and save it as .git/hooks/pre-push. Then make the files executable by entering the following command in the ...