=== Content Version for Git ===
Contributors: maksonlee
Tags: git, version control, revisions, content, github
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.1.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

GitHub-backed version history for WordPress posts, pages, and media.

== Description ==

Content Version for Git stores editable WordPress content snapshots in a configured GitHub repository. It versions posts, pages, terms, and optionally media metadata and original media files. Editors can preview, diff, and restore previous versions from the WordPress admin.

The plugin writes and reads Git objects through the GitHub API. It does not keep a local Git repository and does not call the git CLI.

Features include:

* Automatic Git versions for normal post and page saves.
* Side-by-side content diffs and field diffs.
* Full restore and content-only restore modes.
* Deleted Resources view for posts, pages, and tracked media.
* Restore deleted posts/pages as new drafts and deleted media as new attachments.
* Optional media metadata and file tracking.
* Manual import of existing posts, pages, and media.
* Version store dashboard with branch, latest commit, tracked file count, and GitHub sync status.
* Direct GitHub API commits without a local Git worktree.

== External Services ==

This plugin connects to GitHub when the "Save to GitHub" setting is enabled and a repository URL, branch, and personal access token are configured.

When enabled, the plugin writes Git commits directly to the configured GitHub repository using the GitHub API. Commit data may include post/page content, metadata, term references, media metadata, and media files if media tracking is enabled.

GitHub sync is disabled by default. No data is sent to GitHub unless a site administrator enables and configures it. GitHub's terms and privacy policy apply:

* https://docs.github.com/en/site-policy/github-terms/github-terms-of-service
* https://docs.github.com/en/site-policy/privacy-policies/github-privacy-statement

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/content-version-for-git/` directory, or install the plugin through the WordPress plugins screen.
2. Activate the plugin through the Plugins screen in WordPress.
3. Open Content Versions > Dashboard.
4. Configure GitHub sync and media tracking.
5. Use Import Existing Content if you want to add existing posts, pages, and media to GitHub.

== Frequently Asked Questions ==

= Where are Git versions stored? =

GitHub is the version store. The plugin reads and writes versions through the GitHub API without a local Git repository.

= Does this replace WordPress revisions? =

No. It adds a Git-backed version history for selected WordPress resources.

= Does GitHub sync run by default? =

No. GitHub sync is disabled until an administrator enables it and provides a repository URL, branch, and token. Without GitHub configured, versions are not durably stored across requests.

= What happens if GitHub API writes fail? =

The version is not stored. Configure GitHub before relying on the plugin for durable version history.

= Are media files stored in Git? =

Only when media tracking is enabled. In that mode, referenced media metadata and files are committed directly to GitHub.

== Screenshots ==

1. Content Versions Dashboard showing version store status, settings, import controls, and GitHub sync.
2. Content Versions page for a post with preview, diff, and restore actions.
3. Side-by-side content diff and field diff view.
4. Deleted Resources list with post, page, and media restore options.

== Changelog ==

= 0.1.3 =

* Tightened restore permissions for full Git version restores.
* Replaced trusted output wrappers with late escaping for generated admin HTML.
* Removed runtime shell diff generation from the diff view.

= 0.1.2 =

* Renamed the plugin and package slug for WordPress.org resubmission.

= 0.1.1 =

* Addressed WordPress.org review feedback for asset enqueuing, filesystem locations, and plugin metadata.

= 0.1.0 =

* Initial public release candidate.
* Added Git-backed versions for posts, pages, terms, and optional media resources.
* Added preview, diff, full restore, and content-only restore.
* Added Deleted Resources and restore-as-new flows.
* Added import existing content controls.
* Added GitHub sync settings.
