# Git Repository Guide

[![git-scm.com](https://img.shields.io/badge/git--scm.com-0288D1?style=flat)](https://git-scm.com/)
[![documentation](https://img.shields.io/badge/documentation-077b70?style=flat)](https://git-scm.com/book/en/v2)

Exclude Files from Version Tracking
------------------------------------

[![documentation](https://img.shields.io/badge/documentation-Recording_Changes_to_the_Repository-077b70?style=flat)](https://git-scm.com/book/ms/v2/Git-Basics-Recording-Changes-to-the-Repository)

```gitignore filename=".gitignore"
# SPDX-License-Identifier: 0BSD
# SPDX-FileCopyrightText: none

*.backup
*.bak
*.key
*.local
*.log
*.pem
*.sqlite*
*.swp
*.tmp
*~
```

Keep Git Hooks in Project
--------------------------

[![documentation](https://img.shields.io/badge/documentation-Git_Hooks-077b70?style=flat)](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks)

#### Git Hooks Initialization Recipe

##### Just

```just filename=".just/githooks.just"
# SPDX-License-Identifier: 0BSD
# SPDX-FileCopyrightText: none
#
# Manage the Git hooks living in this repository.

# Run the recipes at the project root, not at the `.just` directory.
set working-directory := '..'

GITHOOKS := ".githooks"

# Configure Git to use the local `.githooks` directory.
init:
    git config --local core.hooksPath "{{ GITHOOKS }}"
```

```just
# Manage the Git hooks living in this repository.
[group('githooks')]
mod githooks '.just/githooks.just'
```

##### Make

```make filename=".githooks/githooks.mk"
# SPDX-License-Identifier: 0BSD
# SPDX-FileCopyrightText: none
#
# Manage the Git hooks living in this repository.

GITHOOKS := .githooks

.PHONY: githooks
githooks:
	git config --local core.hooksPath "$(GITHOOKS)"
```

```make
include .githooks/githooks.mk
```