Hook collections are plain JSON files stored on disk. Git integration lets you version-control these files directly from within Hook, without switching to a terminal or external Git client.
Every save can optionally be staged and committed automatically, creating a full history of collection changes. Push and pull let you share collections with a team via a remote repository.
Git integration requires libgit2. Hook is compiled with
-DHAVE_LIBGIT2 and linked against -lgit2.
Enable Git in the Git popup (click Git on the toolbar):
On save, if no .git directory exists, Hook initializes a
new repository in the current working directory.
Git operations (Stage All, status) only apply to files in:
collections/environments/mock-routes/scripts/user-agents/Files outside these directories are ignored by Hook’s Git panel.
The Git popup shows:
These operate on the selected file in the Status list:
Shows changed files with status flags: [staged], [new], [modified], [deleted]. Click a file to select it for per-file operations.
Enter a commit message and click Commit. If no files are staged, the commit is rejected with a log message.
Shows recent commit history (hash + message).
Enter a branch name, then Create or Switch.
x-access-token user)<path>.pub)Push sends the current branch to the “origin” remote. The remote URL and auth credentials must be configured in Remote settings.
Pull fetches from “origin” and fast-forward merges the current branch. If the merge is not a fast-forward (divergent histories), Pull returns an error – manual merge with an external Git client is required.
Auth types: - Token: for GitHub/GitLab personal
access tokens over HTTPS - Basic: for username/password
over HTTPS - SSH: for SSH key authentication
(e.g. git@github.com:user/repo.git)
All git operations are available from the command line:
hook git status Show changed files
hook git stage <path> Stage a specific file
hook git stage --all Stage all changes
hook git unstage <path> Unstage a file
hook git commit -m "msg" Commit staged changes
hook git log [--max N] Show commit history
hook git diff [path] Show working directory diff
hook git restore <path> Discard changes to a file
hook git branch List branches
hook git branch <name> Create a new branch
hook git switch <name> Switch to a branch
See CLI Reference for detailed syntax and output format.
Set git_auto_stage=1 and git_auto_commit=1
in hook.conf (or enable them via the Git panel checkboxes). Every time
you save a collection or environment (including after imports), Hook
automatically stages the file and commits it with a message like
auto: update collections/my-api.json.
To undo local modifications to a file:
To reset an entire directory (e.g. all collections):
To reset everything: click Reset All (restores all watched files).
If the working directory is not a Git repository, Hook initializes one automatically when Git is enabled and settings are saved.
When Git integration is enabled, the Git toolbar button changes color to reflect the current repository state:
| Color | State | Meaning |
|---|---|---|
| Gray | Disabled | Git integration is off |
| Green | Clean | Working tree is clean, nothing to push |
| Orange | Dirty | Uncommitted changes in watched directories |
| Blue | Ahead | Local commits not yet pushed to remote |
| Red | Error | Repository error (e.g. repo not found) |
Priority when multiple states apply: Error > Dirty > Ahead > Clean.
The Git settings panel includes a “Pull check” slider (0-180 minutes, step 5). This controls how often Hook fetches from the remote to check if there are new commits to pull.
When the pull check interval is enabled (> 0):
When the remote has commits not yet pulled, a colored notification appears in the center of the main statusbar:
N commit(s) to pull
This notification is visible even when the Git popup is closed.
Note: The fetch operation briefly blocks the UI while contacting the remote. With a minimum interval of 5 minutes, this is rarely noticeable.
All git operation messages (stage, unstage, commit, push, pull, etc.) appear directly in the Git popup next to the “Status:” label, instead of in the main statusbar.