Git ~ Advanced - rohit120582sharma/Documentation GitHub Wiki

Git Hooks

Git hooks allows you to run custom scripts whenever certain important events occur in the Git life-cycle, such as committing, merging, and pushing.

Client side hooks are triggered by operations such as committing and merging. Server side hooks are triggered by network operations such as receiving pushed commits.

They are useful to automate tasks. Example: You create a Git Hook to run a linter every time you commit code.

Upon initialising a repo, you will have a .git/hooks directory. Within this folder, you will have some example hooks. These scripts are all Shell and Perl scripts.

References


Garbage collection

The git prune command is an internal housekeeping utility that cleans up unreachable or "orphaned" Git objects. Any commit that cannot be accessed through a branch or tag is considered unreachable. git prune is generally not executed directly. Prune is considered a garbage collection command and is a child command of the git gc command.

⚠️ **GitHub.com Fallback** ⚠️