PHPackages                             wp-php-toolkit/git - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wp-php-toolkit/git

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wp-php-toolkit/git
==================

Git component for WordPress.

v0.8.1(1mo ago)0877GPL-2.0-or-laterPHPPHP &gt;=7.2

Since May 29Pushed 1mo agoCompare

[ Source](https://github.com/wp-php-toolkit/git)[ Packagist](https://packagist.org/packages/wp-php-toolkit/git)[ Docs](https://wordpress.github.io/php-toolkit/reference/git.html)[ RSS](/packages/wp-php-toolkit-git/feed)WikiDiscussions trunk Synced today

READMEChangelogDependencies (16)Versions (49)Used By (0)

   slug git   title Git   install wp-php-toolkit/git   see\_also    filesystem | Filesystem | Work with repository trees through a storage abstraction.

 merge | Merge | Resolve divergent histories with explicit three-way merge logic.

 bytestream | ByteStream | Read and write object data without accidental buffering.

    A PHP implementation of core Git repository operations plus HTTP protocol helpers. Commits, branches, diffs, and selected push/pull workflows run without shelling out to `git`.

Why this exists
---------------

[](#why-this-exists)

Git is a useful storage model even when a server cannot run the `git` binary: snapshots, branches, object-addressed files, diffs, merges, and sync over HTTP. That matters for WordPress tools that want revision history for generated files, content snapshots, site state, or collaborative edits in constrained runtimes.

The Git component implements the core repository operations in PHP and stores objects through the toolkit `Filesystem` interface. That means the same repository can live on disk, in memory, or in another backend, and higher-level code can commit files without knowing where objects are stored. It is a toolkit implementation for supported workflows, not a complete replacement for every `git` command and protocol edge case.

Git object storage and pack processing use zlib compression through the ByteStream compression filters.

The docs start with simple commits because that mental model scales: a repository is just objects plus refs. From there, branches, history walking, root commits, and merges become details you can reason about instead of magic shell behavior.

Choose it for tests, browser-like sandboxes, hosted WordPress environments, and applications that need Git behavior through PHP APIs instead of shell commands.

Commit files into an in-memory repo
-----------------------------------

[](#commit-files-into-an-in-memory-repo)

The simplest possible repository: an `InMemoryFilesystem` as object storage and one `commit()` call. Reach for this in tests, in WP-CLI snapshots, or any place you want versioning without touching disk.

```
