Download the PHP package wp-php-toolkit/git without Composer
On this page you can find all versions of the php package wp-php-toolkit/git. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wp-php-toolkit/git
More information about wp-php-toolkit/git
Files in wp-php-toolkit/git
Package git
Short Description Git component for WordPress.
License GPL-2.0-or-later
Homepage https://wordpress.github.io/php-toolkit/reference/git.html
Informations about the package git
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
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
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.
Walk the commit history
Follow the parent chain from HEAD backwards. Building block for a WP-CLI "post revisions" log or a "what changed since release X" report.
Treat a repository like a filesystem
GitFilesystem wraps a repository in this toolkit's Filesystem interface. With the default options, each put_contents() records a new commit.
Branch, edit, and switch back
Create a feature branch off the current commit, change files, flip HEAD back. Useful for experimental edits in collaborative tools.
Three-way merge two branches
The classic Git workflow: branch off, edit on each side, merge. $repo->merge() finds the common ancestor, three-way-merges every file, and creates a merge commit.
Snapshot WordPress options into a repo
Serialize a chunk of WP state (options, post meta, a theme config) on every save and commit it. You get free history, diffs between snapshots, and a "rollback to last week" button.
All versions of git with dependencies
wp-php-toolkit/bytestream Version ^0.8.1
wp-php-toolkit/filesystem Version ^0.8.1
wp-php-toolkit/http-client Version ^0.8.1