{"id":22425349,"url":"https://github.com/phppkg/phpgit","last_synced_at":"2025-08-01T08:32:57.614Z","repository":{"id":37860996,"uuid":"410749018","full_name":"phppkg/phpgit","owner":"phppkg","description":"🛠  Git wrapper and feature extension library written in PHP.","archived":false,"fork":false,"pushed_at":"2025-08-01T01:41:25.000Z","size":465,"stargazers_count":13,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-01T03:29:18.861Z","etag":null,"topics":["changelog-generator","git","git-php","php-git"],"latest_commit_sha":null,"homepage":"https://phppkg.github.io/phpgit/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phppkg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-09-27T05:09:03.000Z","updated_at":"2025-08-01T01:41:22.000Z","dependencies_parsed_at":"2024-02-01T04:25:57.743Z","dependency_job_id":"7f7ce51d-9c8d-4edc-ae8c-34b180ef001c","html_url":"https://github.com/phppkg/phpgit","commit_stats":{"total_commits":147,"total_committers":5,"mean_commits":29.4,"dds":0.4693877551020408,"last_synced_commit":"d24abaebca36ae0ef194948e08b5a9dec2ef6b6a"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/phppkg/phpgit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phppkg%2Fphpgit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phppkg%2Fphpgit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phppkg%2Fphpgit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phppkg%2Fphpgit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phppkg","download_url":"https://codeload.github.com/phppkg/phpgit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phppkg%2Fphpgit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268167586,"owners_count":24206614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["changelog-generator","git","git-php","php-git"],"created_at":"2024-12-05T19:13:52.570Z","updated_at":"2025-08-01T08:32:57.591Z","avatar_url":"https://github.com/phppkg.png","language":"PHP","readme":"# PhpGit\n\n[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/phppkg/phpgit)](https://github.com/phppkg/phpgit)\n[![Php Version Support](https://img.shields.io/packagist/php-v/phppkg/phpgit)](https://packagist.org/packages/phppkg/phpgit)\n[![Unit Tests](https://github.com/phppkg/phpgit/actions/workflows/php.yml/badge.svg)](https://github.com/phppkg/phpgit/actions)\n[![Deploy Pages](https://github.com/phppkg/phpgit/actions/workflows/static.yml/badge.svg)](https://github.com/phppkg/phpgit/actions/workflows/static.yml)\n\n\u003e **[中文说明](README.zh-CN.md)**\n\nPhpGit - 💪 Git wrapper and feature extension library written in PHP.\n\n\u003e The project is forked from https://github.com/kzykhys/PHPGit\n\n**Features**\n\n- Quick run git commands, eg: `clone,add,commit,merge`\n- Git repo info fetch: `status` `branch` `remote`\n- Generate changelog by git log\n\n## Installation\n\n**Requirements**\n\n* PHP 8.1+\n* Git\n\n**Method 1: directly composer require**\n\n```bash\ncomposer require phppkg/phpgit\n```\n\n**Method 2: update composer.json**\n\nUpdate your composer.json and run `composer update`\n\n``` json\n{\n    \"require\": {\n        \"phppkg/phpgit\": \"dev-master\"\n    }\n}\n```\n\n## Basic Usage\n\n```php\n\u003c?php\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n$git = PhpGit\\Git::new();\n$git-\u003eclone('https://github.com/phppkg/PhpGit.git', '/path/to/repo');\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('production', 'git://example.com/your/repo.git');\n\n$git-\u003eadd('README.md');\n$git-\u003ecommit('Adds README.md');\n\n$git-\u003echeckout('release');\n$git-\u003emerge('master');\n\n$git-\u003epush();\n$git-\u003epush('production', 'release');\n\n$git-\u003etag-\u003ecreate('v1.0.1', 'release');\n\nforeach ($git-\u003etree('release') as $object) {\n    if ($object['type'] == 'blob') {\n        echo $git-\u003eshow($object['file']);\n    }\n}\n```\n\n## Git Info\n\n```php\n$repo = PhpGit\\Repo::new('/path/to/repo');\n\n$remotes = $repo-\u003egetRemotes();\n\n$url  = $repo-\u003egetRemoteUrl('origin');\n$info = $repo-\u003egetRemoteInfo('origin');\n\nvar_dump($info);\n```\n\n**Output:**\n\n```text\nobject(PhpGit\\Info\\RemoteInfo)#35 (8) {\n  [\"type\"]=\u003e string(4) \"http\"\n  [\"name\"]=\u003e string(6) \"origin\"\n  [\"url\"]=\u003e string(34) \"https://github.com/phppkg/phpgit.git\"\n  [\"scheme\"]=\u003e string(5) \"https\"\n  [\"host\"]=\u003e string(10) \"github.com\"\n  [\"path\"]=\u003e string(11) \"phppkg/phpgit\"\n  [\"group\"]=\u003e string(4) \"ulue\"\n  [\"repo\"]=\u003e string(6) \"phpgit\"\n}\n```\n\n## Changelog\n\nProvide quick generate formatted changelog.\n\n### Formatter\n\n- `SimpleFormatter`\n- `MarkdownFormatter`\n- `GithubReleaseFormatter`\n\n### Filter\n\n- `KeywordFilter`\n- `KeywordsFilter`\n- `MsgLenFilter`\n- `WordsLenFilter`\n\n### Example\n\n```php\nuse Toolkit\\Cli\\Color;\nuse PhpGit\\Changelog\\Formatter\\GithubReleaseFormatter;\nuse PhpGit\\Changelog\\Formatter\\SimpleFormatter;\nuse PhpGit\\Changelog\\GitChangeLog;\n\n// this is built in log format.\n// you can custom format string, but must be set an log parser by $gcl-\u003esetLineParser(new YourLineParser);\n$logFormat = GitChangeLog::LOG_FMT_HSC;\n\n$oldVersion = 'v0.2.1';\n$newVersion = 'HEAD';\n\n// get output by git log cmd:\n//  `git log v0.2.1...HEAD --reverse --pretty=format:\"%H | %s | %cn\" --no-merges`\n$c = PhpGit\\Git::new()-\u003enewCmd('log');\n$c-\u003eadd(\"$oldVersion...$newVersion\");\n$c-\u003eadd('--reverse');\n$c-\u003eaddf('--pretty=format:\"%s\"', $logFormat);\n\n// get repo url\n$info = PhpGit\\Repo::new()-\u003egetRemoteInfo('origin');\n$repoUrl = $info-\u003egetHttpUrl();\nColor::info('repo URL: ' . $repoUrl);\n\n// create object by output.\n$gcl = GitChangeLog::new($c-\u003egetOutput());\n$gcl-\u003esetLogFormat($logFormat);\n$gcl-\u003esetRepoUrl($repoUrl);\n\n// you can set output style. default is markdown.\n// can also, you can custom your item formatter\n$gcl-\u003esetItemFormatter(new GithubReleaseFormatter());\n//$gcl-\u003esetItemFormatter(new SimpleFormatter());\n\nColor::info('parse logs and generate changelog');\n\n// parse and generate.\n$str = $gcl-\u003egenerate();\n\necho $str;\n```\n\nRun example `php bin/chlog.php` will see:\n\n```text\n\u003e git log v0.2.1...HEAD --reverse --pretty=format:\"%H | %s | %cn\" --no-merges\n\u003e git remote -v\n[INFO] repo URL:https://github.com/phppkg/phpgit\n[INFO] parse logs and generate changelog\n\n### Fixed\n\n - fix get latest tag error on windows https://github.com/phppkg/phpgit/commit/b9892b0ec363e405fcb76b08ea971fb651b4d2dc\n\n### Update\n\n - up: rename package org to phppkg https://github.com/phppkg/phpgit/commit/990e55c6beddf654819c323c2a18d329074399f9\n - update some info https://github.com/phppkg/phpgit/commit/\"1110de8b5ef0406c837bcd65f607b6f9483c9154\n\n### Feature\n\n - feat: add util for quick generate change log https://github.com/phppkg/phpgit/commit/50962c12d3f16cdbbd8c1f21bc17ff920842365e\n\n```\n\n## API\n\n### Git commands\n\n- [PhpGit](#phpgit)\n  - [Installation](#installation)\n  - [Basic Usage](#basic-usage)\n  - [Git Info](#git-info)\n  - [Changelog](#changelog)\n    - [Formatter](#formatter)\n    - [Filter](#filter)\n    - [Example](#example)\n  - [API](#api)\n    - [Git commands](#git-commands)\n    - [git add](#git-add)\n        - [Options](#options)\n    - [git archive](#git-archive)\n      - [$git-\\\u003earchive(_string_ $file, _string_ $tree = null, _string|array|\\\\Traversable_ $path = null, _array_ $options = \\[\\])](#git-archivestring-file-string-tree--null-stringarraytraversable-path--null-array-options--)\n        - [Options](#options-1)\n    - [git branch](#git-branch)\n      - [$git-\\\u003ebranch(_array_ $options = \\[\\])](#git-brancharray-options--)\n        - [Output Example](#output-example)\n        - [Options](#options-2)\n      - [$git-\\\u003ebranch-\\\u003ecreate(_string_ $branch, _string_ $startPoint = null, _array_ $options = \\[\\])](#git-branch-createstring-branch-string-startpoint--null-array-options--)\n        - [Options](#options-3)\n      - [$git-\\\u003ebranch-\\\u003emove(_string_ $branch, _string_ $newBranch, _array_ $options = \\[\\])](#git-branch-movestring-branch-string-newbranch-array-options--)\n        - [Options](#options-4)\n      - [$git-\\\u003ebranch-\\\u003edelete(_string_ $branch, _array_ $options = \\[\\])](#git-branch-deletestring-branch-array-options--)\n        - [Options](#options-5)\n    - [git cat-file](#git-cat-file)\n      - [$git-\\\u003ecat-\\\u003eblob(_string_ $object)](#git-cat-blobstring-object)\n      - [$git-\\\u003ecat-\\\u003etype(_string_ $object)](#git-cat-typestring-object)\n      - [$git-\\\u003ecat-\\\u003esize(_string_ $object)](#git-cat-sizestring-object)\n    - [git checkout](#git-checkout)\n      - [$git-\\\u003echeckout(_string_ $branch, _array_ $options = \\[\\])](#git-checkoutstring-branch-array-options--)\n        - [Options](#options-6)\n      - [$git-\\\u003echeckout-\\\u003ecreate(_string_ $branch, _string_ $startPoint = null, _array_ $options = \\[\\])](#git-checkout-createstring-branch-string-startpoint--null-array-options--)\n        - [Options](#options-7)\n      - [$git-\\\u003echeckout-\\\u003eorphan(_string_ $branch, _string_ $startPoint = null, _array_ $options = \\[\\])](#git-checkout-orphanstring-branch-string-startpoint--null-array-options--)\n        - [Options](#options-8)\n    - [git clone](#git-clone)\n      - [$git-\\\u003eclone(_string_ $repository, _string_ $path = null, _array_ $options = \\[\\])](#git-clonestring-repository-string-path--null-array-options--)\n        - [Options](#options-9)\n    - [git commit](#git-commit)\n      - [$git-\\\u003ecommit(_string_ $message, _array_ $options = \\[\\])](#git-commitstring-message-array-options--)\n        - [Options](#options-10)\n    - [git config](#git-config)\n      - [$git-\\\u003econfig(_array_ $options = \\[\\])](#git-configarray-options--)\n        - [Options](#options-11)\n      - [$git-\\\u003econfig-\\\u003eset(_string_ $name, _string_ $value, _array_ $options = \\[\\])](#git-config-setstring-name-string-value-array-options--)\n        - [Options](#options-12)\n      - [$git-\\\u003econfig-\\\u003eadd(_string_ $name, _string_ $value, _array_ $options = \\[\\])](#git-config-addstring-name-string-value-array-options--)\n        - [Options](#options-13)\n    - [git describe](#git-describe)\n      - [$git-\\\u003edescribe(_string_ $committish = null, _array_ $options = \\[\\])](#git-describestring-committish--null-array-options--)\n        - [Output Example](#output-example-1)\n        - [Options](#options-14)\n      - [$git-\\\u003edescribe-\\\u003etags(_string_ $committish = null, _array_ $options = \\[\\])](#git-describe-tagsstring-committish--null-array-options--)\n    - [git fetch](#git-fetch)\n      - [$git-\\\u003efetch(_string_ $repository, _string_ $refspec = null, _array_ $options = \\[\\])](#git-fetchstring-repository-string-refspec--null-array-options--)\n        - [Options](#options-15)\n      - [$git-\\\u003efetch-\\\u003eall(_array_ $options = \\[\\])](#git-fetch-allarray-options--)\n        - [Options](#options-16)\n    - [git init](#git-init)\n      - [$git-\\\u003einit(_string_ $path, _array_ $options = \\[\\])](#git-initstring-path-array-options--)\n        - [Options](#options-17)\n    - [git log](#git-log)\n      - [$git-\\\u003elog(_string_ $revRange = '', _string_ $path = null, _array_ $options = \\[\\])](#git-logstring-revrange---string-path--null-array-options--)\n        - [Output Example](#output-example-2)\n        - [Options](#options-18)\n    - [git merge](#git-merge)\n      - [$git-\\\u003emerge(_string|array|\\\\Traversable_ $commit, _string_ $message = null, _array_ $options = \\[\\])](#git-mergestringarraytraversable-commit-string-message--null-array-options--)\n        - [Options](#options-19)\n      - [$git-\\\u003emerge-\\\u003eabort()](#git-merge-abort)\n    - [git mv](#git-mv)\n      - [$git-\\\u003emv(_string|array|\\\\Iterator_ $source, _string_ $destination, _array_ $options = \\[\\])](#git-mvstringarrayiterator-source-string-destination-array-options--)\n        - [Options](#options-20)\n    - [git pull](#git-pull)\n      - [$git-\\\u003epull(_string_ $repository = null, _string_ $refspec = null, _array_ $options = \\[\\])](#git-pullstring-repository--null-string-refspec--null-array-options--)\n    - [git push](#git-push)\n      - [$git-\\\u003epush(_string_ $repository = null, _string_ $refspec = null, _array_ $options = \\[\\])](#git-pushstring-repository--null-string-refspec--null-array-options--)\n    - [git rebase](#git-rebase)\n      - [$git-\\\u003erebase(_string_ $upstream = null, _string_ $branch = null, _array_ $options = \\[\\])](#git-rebasestring-upstream--null-string-branch--null-array-options--)\n        - [Options](#options-21)\n      - [$git-\\\u003erebase-\\\u003econtinues()](#git-rebase-continues)\n      - [$git-\\\u003erebase-\\\u003eabort()](#git-rebase-abort)\n      - [$git-\\\u003erebase-\\\u003eskip()](#git-rebase-skip)\n    - [git remote](#git-remote)\n      - [$git-\\\u003eremote()](#git-remote-1)\n        - [Output Example](#output-example-3)\n      - [$git-\\\u003eremote-\\\u003eadd(_string_ $name, _string_ $url, _array_ $options = \\[\\])](#git-remote-addstring-name-string-url-array-options--)\n        - [Options](#options-22)\n      - [$git-\\\u003eremote-\\\u003erename(_string_ $name, _string_ $newName)](#git-remote-renamestring-name-string-newname)\n      - [$git-\\\u003eremote-\\\u003erm(_string_ $name)](#git-remote-rmstring-name)\n      - [$git-\\\u003eremote-\\\u003eshow(_string_ $name)](#git-remote-showstring-name)\n        - [Output Example](#output-example-4)\n      - [$git-\\\u003eremote-\\\u003eprune(_string_ $name = null)](#git-remote-prunestring-name--null)\n      - [$git-\\\u003eremote-\\\u003ehead(_string_ $name, _string_ $branch = null)](#git-remote-headstring-name-string-branch--null)\n      - [$git-\\\u003eremote-\\\u003ehead-\\\u003eset(_string_ $name, _string_ $branch)](#git-remote-head-setstring-name-string-branch)\n      - [$git-\\\u003eremote-\\\u003ehead-\\\u003edelete(_string_ $name)](#git-remote-head-deletestring-name)\n      - [$git-\\\u003eremote-\\\u003ehead-\\\u003eremote(_string_ $name)](#git-remote-head-remotestring-name)\n      - [$git-\\\u003eremote-\\\u003ebranches(_string_ $name, _array_ $branches)](#git-remote-branchesstring-name-array-branches)\n      - [$git-\\\u003eremote-\\\u003ebranches-\\\u003eset(_string_ $name, _array_ $branches)](#git-remote-branches-setstring-name-array-branches)\n      - [$git-\\\u003eremote-\\\u003ebranches-\\\u003eadd(_string_ $name, _array_ $branches)](#git-remote-branches-addstring-name-array-branches)\n      - [$git-\\\u003eremote-\\\u003eurl(_string_ $name, _string_ $newUrl, _string_ $oldUrl = null, _array_ $options = \\[\\])](#git-remote-urlstring-name-string-newurl-string-oldurl--null-array-options--)\n        - [Options](#options-23)\n      - [$git-\\\u003eremote-\\\u003eurl-\\\u003eset(_string_ $name, _string_ $newUrl, _string_ $oldUrl = null, _array_ $options = \\[\\])](#git-remote-url-setstring-name-string-newurl-string-oldurl--null-array-options--)\n        - [Options](#options-24)\n      - [$git-\\\u003eremote-\\\u003eurl-\\\u003eadd(_string_ $name, _string_ $newUrl, _array_ $options = \\[\\])](#git-remote-url-addstring-name-string-newurl-array-options--)\n        - [Options](#options-25)\n      - [$git-\\\u003eremote-\\\u003eurl-\\\u003edelete(_string_ $name, _string_ $url, _array_ $options = \\[\\])](#git-remote-url-deletestring-name-string-url-array-options--)\n        - [Options](#options-26)\n    - [git reset](#git-reset)\n      - [$git-\\\u003ereset(_string|array|\\\\Traversable_ $paths, _string_ $commit = null)](#git-resetstringarraytraversable-paths-string-commit--null)\n      - [$git-\\\u003ereset-\\\u003esoft(_string_ $commit = null)](#git-reset-softstring-commit--null)\n      - [$git-\\\u003ereset-\\\u003emixed(_string_ $commit = null)](#git-reset-mixedstring-commit--null)\n      - [$git-\\\u003ereset-\\\u003ehard(_string_ $commit = null)](#git-reset-hardstring-commit--null)\n      - [$git-\\\u003ereset-\\\u003emerge(_string_ $commit = null)](#git-reset-mergestring-commit--null)\n      - [$git-\\\u003ereset-\\\u003ekeep(_string_ $commit = null)](#git-reset-keepstring-commit--null)\n      - [$git-\\\u003ereset-\\\u003emode(_string_ $mode, _string_ $commit = null)](#git-reset-modestring-mode-string-commit--null)\n    - [git rm](#git-rm)\n      - [$git-\\\u003erm(_string|array|\\\\Traversable_ $file, _array_ $options = \\[\\])](#git-rmstringarraytraversable-file-array-options--)\n        - [Options](#options-27)\n      - [$git-\\\u003erm-\\\u003ecached(_string|array|\\\\Traversable_ $file, _array_ $options = \\[\\])](#git-rm-cachedstringarraytraversable-file-array-options--)\n        - [Options](#options-28)\n    - [git shortlog](#git-shortlog)\n      - [$git-\\\u003eshortlog(_string|array|\\\\Traversable_ $commits = HEAD)](#git-shortlogstringarraytraversable-commits--head)\n        - [Output Example](#output-example-5)\n      - [$git-\\\u003eshortlog-\\\u003esummary(_string_ $commits = HEAD)](#git-shortlog-summarystring-commits--head)\n        - [Output Example](#output-example-6)\n    - [git show](#git-show)\n      - [$git-\\\u003eshow(_string_ $object, _array_ $options = \\[\\])](#git-showstring-object-array-options--)\n        - [Options](#options-29)\n    - [git stash](#git-stash)\n      - [$git-\\\u003estash()](#git-stash-1)\n      - [$git-\\\u003estash-\\\u003esave(_string_ $message = null, _array_ $options = \\[\\])](#git-stash-savestring-message--null-array-options--)\n      - [$git-\\\u003estash-\\\u003elists(_array_ $options = \\[\\])](#git-stash-listsarray-options--)\n        - [Output Example](#output-example-7)\n      - [$git-\\\u003estash-\\\u003eshow(_string_ $stash = null)](#git-stash-showstring-stash--null)\n        - [Output Example](#output-example-8)\n      - [$git-\\\u003estash-\\\u003edrop(_string_ $stash = null)](#git-stash-dropstring-stash--null)\n      - [$git-\\\u003estash-\\\u003epop(_string_ $stash = null, _array_ $options = \\[\\])](#git-stash-popstring-stash--null-array-options--)\n      - [$git-\\\u003estash-\\\u003eapply(_string_ $stash = null, _array_ $options = \\[\\])](#git-stash-applystring-stash--null-array-options--)\n      - [$git-\\\u003estash-\\\u003ebranch(_string_ $name, _string_ $stash = null)](#git-stash-branchstring-name-string-stash--null)\n      - [$git-\\\u003estash-\\\u003eclear()](#git-stash-clear)\n      - [$git-\\\u003estash-\\\u003ecreate()](#git-stash-create)\n        - [Output Example](#output-example-9)\n    - [git status](#git-status)\n      - [$git-\\\u003estatus(_array_ $options = \\[\\])](#git-statusarray-options--)\n        - [Constants](#constants)\n        - [Output Example](#output-example-10)\n        - [Options](#options-30)\n    - [git tag](#git-tag)\n      - [$git-\\\u003etag()](#git-tag-1)\n        - [Output Example](#output-example-11)\n      - [$git-\\\u003etag-\\\u003ecreate(_string_ $tag, _string_ $commit = null, _array_ $options = \\[\\])](#git-tag-createstring-tag-string-commit--null-array-options--)\n        - [Options](#options-31)\n      - [$git-\\\u003etag-\\\u003edelete(_string|array|\\\\Traversable_ $tag)](#git-tag-deletestringarraytraversable-tag)\n      - [$git-\\\u003etag-\\\u003everify(_string|array|\\\\Traversable_ $tag)](#git-tag-verifystringarraytraversable-tag)\n    - [git ls-tree](#git-ls-tree)\n      - [$git-\\\u003etree(_string_ $branch = master, _string_ $path = '')](#git-treestring-branch--master-string-path--)\n        - [Output Example](#output-example-12)\n  - [License](#license)\n  - [Author](#author)\n\n* * * * *\n\n### git add\n\n```php\n$git-\u003eadd(string|array|\\Traversable $file, array $options = [])\n```\n\nAdd file contents to the index\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eadd('file.txt');\n$git-\u003eadd('file.txt', ['force' =\u003e false, 'ignore-errors' =\u003e false);\n```\n\n##### Options\n\n- **force**          (_boolean_) Allow adding otherwise ignored files\n- **ignore-errors**  (_boolean_) Do not abort the operation\n\n* * * * *\n\n### git archive\n\n#### $git-\u003earchive(_string_ $file, _string_ $tree = null, _string|array|\\Traversable_ $path = null, _array_ $options = [])\n\nCreate an archive of files from a named tree\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003earchive('repo.zip', 'master', null, ['format' =\u003e 'zip']);\n```\n\n##### Options\n\n- **format** (_boolean_) Format of the resulting archive: tar or zip\n- **prefix** (_boolean_) Prepend prefix/ to each filename in the archive\n\n* * * * *\n\n### git branch\n\n#### $git-\u003ebranch(_array_ $options = [])\n\nReturns an array of both remote-tracking branches and local branches\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$branches = $git-\u003ebranch();\n```\n\n##### Output Example\n\n```\n[\n    'master' =\u003e ['current' =\u003e true, 'name' =\u003e 'master', 'hash' =\u003e 'bf231bb', 'title' =\u003e 'Initial Commit'],\n    'origin/master' =\u003e ['current' =\u003e false, 'name' =\u003e 'origin/master', 'alias' =\u003e 'remotes/origin/master']\n]\n```\n\n##### Options\n\n- **all**     (_boolean_) List both remote-tracking branches and local branches\n- **remotes** (_boolean_) List the remote-tracking branches\n\n#### $git-\u003ebranch-\u003ecreate(_string_ $branch, _string_ $startPoint = null, _array_ $options = [])\n\nCreates a new branch head named **$branch** which points to the current HEAD, or **$startPoint** if given\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003ebranch-\u003ecreate('bugfix');              // from current HEAD\n$git-\u003ebranch-\u003ecreate('patch-1', 'a092bf7s'); // from commit\n$git-\u003ebranch-\u003ecreate('1.0.x-fix', 'v1.0.2'); // from tag\n```\n\n##### Options\n\n- **force**   (_boolean_) Reset **$branch**  to **$startPoint** if **$branch** exists already\n\n#### $git-\u003ebranch-\u003emove(_string_ $branch, _string_ $newBranch, _array_ $options = [])\n\nMove/rename a branch and the corresponding reflog\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003ebranch-\u003emove('bugfix', '2.0');\n```\n\n##### Options\n\n- **force**   (_boolean_) Move/rename a branch even if the new branch name already exists\n\n#### $git-\u003ebranch-\u003edelete(_string_ $branch, _array_ $options = [])\n\nDelete a branch\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003ebranch-\u003edelete('2.0');\n```\n\nThe branch must be fully merged in its upstream branch, or in HEAD if no upstream was set with --track or --set-upstream.\n\n##### Options\n\n- **force**   (_boolean_) Delete a branch irrespective of its merged status\n\n* * * * *\n\n### git cat-file\n\n#### $git-\u003ecat-\u003eblob(_string_ $object)\n\nReturns the contents of blob object\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$contents = $git-\u003ecat-\u003eblob('e69de29bb2d1d6434b8b29ae775ad8');\n```\n\n#### $git-\u003ecat-\u003etype(_string_ $object)\n\nReturns the object type identified by **$object**\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$type = $git-\u003ecat-\u003etype('e69de29bb2d1d6434b8b29ae775ad8');\n```\n\n#### $git-\u003ecat-\u003esize(_string_ $object)\n\nReturns the object size identified by **$object**\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$type = $git-\u003ecat-\u003esize('e69de29bb2d1d6434b8b29ae775ad8');\n```\n\n* * * * *\n\n### git checkout\n\n#### $git-\u003echeckout(_string_ $branch, _array_ $options = [])\n\nSwitches branches by updating the index, working tree, and HEAD to reflect the specified branch or commit\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003echeckout('develop');\n```\n\n##### Options\n\n- **force** (_boolean_) Proceed even if the index or the working tree differs from HEAD\n- **merge** (_boolean_) Merges local modification\n\n#### $git-\u003echeckout-\u003ecreate(_string_ $branch, _string_ $startPoint = null, _array_ $options = [])\n\nCreate a new branch and checkout\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003echeckout-\u003ecreate('patch-1');\n$git-\u003echeckout-\u003ecreate('patch-2', 'develop');\n```\n\n##### Options\n\n- **force** (_boolean_) Proceed even if the index or the working tree differs from HEAD\n\n#### $git-\u003echeckout-\u003eorphan(_string_ $branch, _string_ $startPoint = null, _array_ $options = [])\n\nCreate a new orphan branch, named \u003cnew_branch\u003e, started from \u003cstart_point\u003e and switch to it\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003echeckout-\u003eorphan('gh-pages');\n```\n\n##### Options\n\n- **force** (_boolean_) Proceed even if the index or the working tree differs from HEAD\n\n* * * * *\n\n### git clone\n\n#### $git-\u003eclone(_string_ $repository, _string_ $path = null, _array_ $options = [])\n\nClone a repository into a new directory\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003eclone('https://github.com/kzykhys/PhpGit.git', '/path/to/repo');\n```\n\n##### Options\n\n- **shared** (_boolean_) Starts out without any object of its own\n- **bare**   (_boolean_) Make a bare GIT repository\n\n* * * * *\n\n### git commit\n\n#### $git-\u003ecommit(_string_ $message, _array_ $options = [])\n\nRecord changes to the repository\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003eclone('https://github.com/kzykhys/PhpGit.git', '/path/to/repo');\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eadd('README.md');\n$git-\u003ecommit('Fixes README.md');\n```\n\n##### Options\n\n- **all**           (_boolean_) Stage files that have been modified and deleted\n- **reuse-message** (_string_)  Take an existing commit object, and reuse the log message and the authorship information (including the timestamp) when creating the commit\n- **squash**        (_string_)  Construct a commit message for use with rebase --autosquash\n- **author**        (_string_)  Override the commit author\n- **date**          (_string_)  Override the author date used in the commit\n- **cleanup**       (_string_)  Can be one of verbatim, whitespace, strip, and default\n- **amend**         (_boolean_) Used to amend the tip of the current branch\n\n* * * * *\n\n### git config\n\n#### $git-\u003econfig(_array_ $options = [])\n\nReturns all variables set in config file\n\n\n##### Options\n\n- **global** (_boolean_) Read or write configuration options for the current user\n- **system** (_boolean_) Read or write configuration options for all users on the current machine\n\n#### $git-\u003econfig-\u003eset(_string_ $name, _string_ $value, _array_ $options = [])\n\nSet an option\n\n##### Options\n\n- **global** (_boolean_) Read or write configuration options for the current user\n- **system** (_boolean_) Read or write configuration options for all users on the current machine\n\n#### $git-\u003econfig-\u003eadd(_string_ $name, _string_ $value, _array_ $options = [])\n\nAdds a new line to the option without altering any existing values\n\n##### Options\n\n- **global** (_boolean_) Read or write configuration options for the current user\n- **system** (_boolean_) Read or write configuration options for all users on the current machine\n\n* * * * *\n\n### git describe\n\n#### $git-\u003edescribe(_string_ $committish = null, _array_ $options = [])\n\nReturns the most recent tag that is reachable from a commit\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003etag-\u003ecreate('v1.0.0');\n$git-\u003ecommit('Fixes #14');\necho $git-\u003edescribe('HEAD', ['tags' =\u003e true]);\n```\n\n##### Output Example\n\n```\nv1.0.0-1-g7049efc\n```\n\n##### Options\n\n- **all**    (_boolean_) Enables matching any known branch, remote-tracking branch, or lightweight tag\n- **tags**   (_boolean_) Enables matching a lightweight (non-annotated) tag\n- **always** (_boolean_) Show uniquely abbreviated commit object as fallback\n\n#### $git-\u003edescribe-\u003etags(_string_ $committish = null, _array_ $options = [])\n\nEquivalent to $git-\u003edescribe($committish, ['tags' =\u003e true]);\n\n* * * * *\n\n### git fetch\n\n#### $git-\u003efetch(_string_ $repository, _string_ $refspec = null, _array_ $options = [])\n\nFetches named heads or tags from one or more other repositories, along with the objects necessary to complete them\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'git://your/repo.git');\n$git-\u003efetch('origin');\n```\n\n##### Options\n\n- **append** (_boolean_) Append ref names and object names of fetched refs to the existing contents of .git/FETCH_HEAD\n- **keep**   (_boolean_) Keep downloaded pack\n- **prune**  (_boolean_) After fetching, remove any remote-tracking branches which no longer exist on the remote\n\n#### $git-\u003efetch-\u003eall(_array_ $options = [])\n\nFetch all remotes\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'git://your/repo.git');\n$git-\u003eremote-\u003eadd('release', 'git://your/another_repo.git');\n$git-\u003efetch-\u003eall();\n```\n\n##### Options\n\n- **append** (_boolean_) Append ref names and object names of fetched refs to the existing contents of .git/FETCH_HEAD\n- **keep**   (_boolean_) Keep downloaded pack\n- **prune**  (_boolean_) After fetching, remove any remote-tracking branches which no longer exist on the remote\n\n* * * * *\n\n### git init\n\n#### $git-\u003einit(_string_ $path, _array_ $options = [])\n\nCreate an empty git repository or reinitialize an existing one\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003einit('/path/to/repo1');\n$git-\u003einit('/path/to/repo2', array('shared' =\u003e true, 'bare' =\u003e true));\n```\n\n##### Options\n\n- **shared** (_boolean_) Specify that the git repository is to be shared amongst several users\n- **bare**   (_boolean_) Create a bare repository\n\n* * * * *\n\n### git log\n\n#### $git-\u003elog(_string_ $revRange = '', _string_ $path = null, _array_ $options = [])\n\nReturns the commit logs\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$logs = $git-\u003elog(array('limit' =\u003e 10));\n```\n\n##### Output Example\n\n``` php\n[\n    0 =\u003e [\n        'hash'  =\u003e '1a821f3f8483747fd045eb1f5a31c3cc3063b02b',\n        'name'  =\u003e 'John Doe',\n        'email' =\u003e 'john@example.com',\n        'date'  =\u003e 'Fri Jan 17 16:32:49 2014 +0900',\n        'title' =\u003e 'Initial Commit'\n    ],\n    1 =\u003e [\n        //...\n    ]\n]\n```\n\n##### Options\n\n- **limit** (_integer_) Limits the number of commits to show\n- **skip**  (_integer_) Skip number commits before starting to show the commit output\n\n* * * * *\n\n### git merge\n\n#### $git-\u003emerge(_string|array|\\Traversable_ $commit, _string_ $message = null, _array_ $options = [])\n\nIncorporates changes from the named commits into the current branch\n\n```php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003emerge('1.0');\n$git-\u003emerge('1.1', 'Merge message', ['strategy' =\u003e 'ours']);\n```\n\n##### Options\n\n- **no-ff**               (_boolean_) Do not generate a merge commit if the merge resolved as a fast-forward, only update the branch pointer\n- **rerere-autoupdate**   (_boolean_) Allow the rerere mechanism to update the index with the result of auto-conflict resolution if possible\n- **squash**              (_boolean_) Allows you to create a single commit on top of the current branch whose effect is the same as merging another branch\n- **strategy**            (_string_)  Use the given merge strategy\n- **strategy-option**     (_string_)  Pass merge strategy specific option through to the merge strategy\n\n#### $git-\u003emerge-\u003eabort()\n\nAbort the merge process and try to reconstruct the pre-merge state\n\n```php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\ntry {\n    $git-\u003emerge('dev');\n} catch (PhpGit\\Exception\\GitException $e) {\n    $git-\u003emerge-\u003eabort();\n}\n```\n\n* * * * *\n\n### git mv\n\n#### $git-\u003emv(_string|array|\\Iterator_ $source, _string_ $destination, _array_ $options = [])\n\nMove or rename a file, a directory, or a symlink\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003emv('UPGRADE-1.0.md', 'UPGRADE-1.1.md');\n```\n\n##### Options\n\n- **force** (_boolean_) Force renaming or moving of a file even if the target exists\n\n* * * * *\n\n### git pull\n\n#### $git-\u003epull(_string_ $repository = null, _string_ $refspec = null, _array_ $options = [])\n\nFetch from and merge with another repository or a local branch\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003epull('origin', 'master');\n```\n\n* * * * *\n\n### git push\n\n#### $git-\u003epush(_string_ $repository = null, _string_ $refspec = null, _array_ $options = [])\n\nUpdate remote refs along with associated objects\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003epush('origin', 'master');\n```\n\n* * * * *\n\n### git rebase\n\n#### $git-\u003erebase(_string_ $upstream = null, _string_ $branch = null, _array_ $options = [])\n\nForward-port local commits to the updated upstream head\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003efetch('origin');\n$git-\u003erebase('origin/master');\n```\n\n##### Options\n\n- **onto**          (_string_)  Starting point at which to create the new commits\n- **no-verify**     (_boolean_) Bypasses the pre-rebase hook\n- **force-rebase**  (_boolean_) Force the rebase even if the current branch is a descendant of the commit you are rebasing onto\n\n#### $git-\u003erebase-\u003econtinues()\n\nRestart the rebasing process after having resolved a merge conflict\n\n#### $git-\u003erebase-\u003eabort()\n\nAbort the rebase operation and reset HEAD to the original branch\n\n#### $git-\u003erebase-\u003eskip()\n\nRestart the rebasing process by skipping the current patch\n\n* * * * *\n\n### git remote\n\n#### $git-\u003eremote()\n\nReturns an array of existing remotes\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003eclone('https://github.com/kzykhys/Text.git', '/path/to/repo');\n$git-\u003esetRepository('/path/to/repo');\n$remotes = $git-\u003eremote();\n```\n\n##### Output Example\n\n``` php\n[\n    'origin' =\u003e [\n        'fetch' =\u003e 'https://github.com/kzykhys/Text.git',\n        'push'  =\u003e 'https://github.com/kzykhys/Text.git'\n    ]\n]\n```\n\n#### $git-\u003eremote-\u003eadd(_string_ $name, _string_ $url, _array_ $options = [])\n\nAdds a remote named **$name** for the repository at **$url**\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003efetch('origin');\n```\n\n##### Options\n\n- **tags**    (_boolean_) With this option, `git fetch \u003cname\u003e` imports every tag from the remote repository\n- **no-tags** (_boolean_) With this option, `git fetch \u003cname\u003e` does not import tags from the remote repository\n\n#### $git-\u003eremote-\u003erename(_string_ $name, _string_ $newName)\n\nRename the remote named **$name** to **$newName**\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003erename('origin', 'upstream');\n```\n\n#### $git-\u003eremote-\u003erm(_string_ $name)\n\nRemove the remote named **$name**\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003erm('origin');\n```\n\n#### $git-\u003eremote-\u003eshow(_string_ $name)\n\nGives some information about the remote **$name**\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003eclone('https://github.com/kzykhys/Text.git', '/path/to/repo');\n$git-\u003esetRepository('/path/to/repo');\necho $git-\u003eremote-\u003eshow('origin');\n```\n\n##### Output Example\n\n```\n\\* remote origin\n  Fetch URL: https://github.com/kzykhys/Text.git\n  Push  URL: https://github.com/kzykhys/Text.git\n  HEAD branch: master\n  Remote branch:\n    master tracked\n  Local branch configured for 'git pull':\n    master merges with remote master\n  Local ref configured for 'git push':\n    master pushes to master (up to date)\n```\n\n#### $git-\u003eremote-\u003eprune(_string_ $name = null)\n\nDeletes all stale remote-tracking branches under **$name**\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eprune('origin');\n```\n\n#### $git-\u003eremote-\u003ehead(_string_ $name, _string_ $branch = null)\n\nAlias of set()\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003ehead('origin');\n```\n\n#### $git-\u003eremote-\u003ehead-\u003eset(_string_ $name, _string_ $branch)\n\nSets the default branch for the named remote\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003ehead-\u003eset('origin');\n```\n\n#### $git-\u003eremote-\u003ehead-\u003edelete(_string_ $name)\n\nDeletes the default branch for the named remote\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003ehead-\u003edelete('origin');\n```\n\n#### $git-\u003eremote-\u003ehead-\u003eremote(_string_ $name)\n\nDetermine the default branch by querying remote\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003ehead-\u003eremote('origin');\n```\n\n#### $git-\u003eremote-\u003ebranches(_string_ $name, _array_ $branches)\n\nAlias of set()\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003ebranches('origin', array('master', 'develop'));\n```\n\n#### $git-\u003eremote-\u003ebranches-\u003eset(_string_ $name, _array_ $branches)\n\nChanges the list of branches tracked by the named remote\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003ebranches-\u003eset('origin', array('master', 'develop'));\n```\n\n#### $git-\u003eremote-\u003ebranches-\u003eadd(_string_ $name, _array_ $branches)\n\nAdds to the list of branches tracked by the named remote\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003ebranches-\u003eadd('origin', array('master', 'develop'));\n```\n\n#### $git-\u003eremote-\u003eurl(_string_ $name, _string_ $newUrl, _string_ $oldUrl = null, _array_ $options = [])\n\nAlias of set()\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003eurl('origin', 'https://github.com/text/Text.git');\n```\n\n##### Options\n\n- **push** (_boolean_) Push URLs are manipulated instead of fetch URLs\n\n#### $git-\u003eremote-\u003eurl-\u003eset(_string_ $name, _string_ $newUrl, _string_ $oldUrl = null, _array_ $options = [])\n\nSets the URL remote to $newUrl\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003eurl-\u003eset('origin', 'https://github.com/text/Text.git');\n```\n\n##### Options\n\n- **push** (_boolean_) Push URLs are manipulated instead of fetch URLs\n\n#### $git-\u003eremote-\u003eurl-\u003eadd(_string_ $name, _string_ $newUrl, _array_ $options = [])\n\nAdds new URL to remote\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003eurl-\u003eadd('origin', 'https://github.com/text/Text.git');\n```\n\n##### Options\n\n- **push** (_boolean_) Push URLs are manipulated instead of fetch URLs\n\n#### $git-\u003eremote-\u003eurl-\u003edelete(_string_ $name, _string_ $url, _array_ $options = [])\n\nDeletes all URLs matching regex $url\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003eremote-\u003eadd('origin', 'https://github.com/kzykhys/Text.git');\n$git-\u003eremote-\u003eurl-\u003edelete('origin', 'https://github.com');\n```\n\n##### Options\n\n- **push** (_boolean_) Push URLs are manipulated instead of fetch URLs\n\n* * * * *\n\n### git reset\n\n#### $git-\u003ereset(_string|array|\\Traversable_ $paths, _string_ $commit = null)\n\nResets the index entries for all **$paths** to their state at **$commit**\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003ereset();\n```\n\n#### $git-\u003ereset-\u003esoft(_string_ $commit = null)\n\nResets the current branch head to **$commit**\n\nDoes not touch the index file nor the working tree at all (but resets the head to **$commit**,\njust like all modes do).\nThis leaves all your changed files \"Changes to be committed\", as git status would put it.\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003ereset-\u003esoft();\n```\n\n#### $git-\u003ereset-\u003emixed(_string_ $commit = null)\n\nResets the current branch head to **$commit**\n\nResets the index but not the working tree (i.e., the changed files are preserved but not marked for commit)\nand reports what has not been updated. This is the default action.\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003ereset-\u003emixed();\n```\n\n#### $git-\u003ereset-\u003ehard(_string_ $commit = null)\n\nResets the current branch head to **$commit**\n\nResets the index and working tree. Any changes to tracked files in the working tree since **$commit** are discarded\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003ereset-\u003ehard();\n```\n\n#### $git-\u003ereset-\u003emerge(_string_ $commit = null)\n\nResets the current branch head to **$commit**\n\nResets the index and updates the files in the working tree that are different between **$commit** and HEAD,\nbut keeps those which are different between the index and working tree\n(i.e. which have changes which have not been added). If a file that is different between **$commit** and\nthe index has unstaged changes, reset is aborted\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003ereset-\u003emerge();\n```\n\n#### $git-\u003ereset-\u003ekeep(_string_ $commit = null)\n\nResets the current branch head to **$commit**\n\nResets index entries and updates files in the working tree that are different between **$commit** and HEAD.\nIf a file that is different between **$commit** and HEAD has local changes, reset is aborted.\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003ereset-\u003ekeep();\n```\n\n#### $git-\u003ereset-\u003emode(_string_ $mode, _string_ $commit = null)\n\nResets the current branch head to **$commit**\n\nPossibly updates the index (resetting it to the tree of **$commit**) and the working tree depending on **$mode**\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003ereset-\u003emode('hard');\n```\n\n* * * * *\n\n### git rm\n\n#### $git-\u003erm(_string|array|\\Traversable_ $file, _array_ $options = [])\n\nRemove files from the working tree and from the index\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003erm('CHANGELOG-1.0-1.1.txt', ['force' =\u003e true]);\n```\n\n##### Options\n\n- **force**     (_boolean_) Override the up-to-date check\n- **cached**    (_boolean_) Unstage and remove paths only from the index\n- **recursive** (_boolean_) Allow recursive removal when a leading directory name is given\n\n#### $git-\u003erm-\u003ecached(_string|array|\\Traversable_ $file, _array_ $options = [])\n\nEquivalent to $git-\u003erm($file, ['cached' =\u003e true]);\n\n##### Options\n\n- **force**     (_boolean_) Override the up-to-date check\n- **recursive** (_boolean_) Allow recursive removal when a leading directory name is given\n\n* * * * *\n\n### git shortlog\n\n#### $git-\u003eshortlog(_string|array|\\Traversable_ $commits = HEAD)\n\nSummarize 'git log' output\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$shortlog = $git-\u003eshortlog();\n```\n\n##### Output Example\n\n``` php\n[\n    'John Doe \u003cjohn@example.com\u003e' =\u003e [\n        0 =\u003e ['commit' =\u003e '589de67', 'date' =\u003e new \\DateTime('2014-02-10 12:56:15 +0300'), 'subject' =\u003e 'Update README'],\n        1 =\u003e ['commit' =\u003e '589de67', 'date' =\u003e new \\DateTime('2014-02-15 12:56:15 +0300'), 'subject' =\u003e 'Update README'],\n    ],\n    //...\n]\n```\n\n#### $git-\u003eshortlog-\u003esummary(_string_ $commits = HEAD)\n\nSuppress commit description and provide a commit count summary only\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$shortlog = $git-\u003eshortlog-\u003esummary();\n```\n\n##### Output Example\n\n``` php\n[\n    'John Doe \u003cjohn@example.com\u003e' =\u003e 153,\n    //...\n]\n```\n\n* * * * *\n\n### git show\n\n#### $git-\u003eshow(_string_ $object, _array_ $options = [])\n\nShows one or more objects (blobs, trees, tags and commits)\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\necho $git-\u003eshow('3ddee587e209661c8265d5bfd0df999836f6dfa2');\n```\n\n##### Options\n\n- **format**        (_string_)  Pretty-print the contents of the commit logs in a given format, where \u003cformat\u003e can be one of oneline, short, medium, full, fuller, email, raw and format:\u003cstring\u003e\n- **abbrev-commit** (_boolean_) Instead of showing the full 40-byte hexadecimal commit object name, show only a partial prefix\n\n* * * * *\n\n### git stash\n\n#### $git-\u003estash()\n\nSave your local modifications to a new stash, and run git reset --hard to revert them\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003estash();\n```\n\n#### $git-\u003estash-\u003esave(_string_ $message = null, _array_ $options = [])\n\nSave your local modifications to a new stash, and run git reset --hard to revert them.\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003estash-\u003esave('My stash');\n```\n\n#### $git-\u003estash-\u003elists(_array_ $options = [])\n\nReturns the stashes that you currently have\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$stashes = $git-\u003estash-\u003elists();\n```\n\n##### Output Example\n\n``` php\n[\n    0 =\u003e ['branch' =\u003e 'master', 'message' =\u003e '0e2f473 Fixes README.md'],\n    1 =\u003e ['branch' =\u003e 'master', 'message' =\u003e 'ce1ddde Initial commit'],\n]\n```\n\n#### $git-\u003estash-\u003eshow(_string_ $stash = null)\n\nShow the changes recorded in the stash as a diff between the stashed state and its original parent\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\necho $git-\u003estash-\u003eshow('stash@{0}');\n```\n\n##### Output Example\n\n```\n REAMDE.md |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n```\n\n#### $git-\u003estash-\u003edrop(_string_ $stash = null)\n\nRemove a single stashed state from the stash list\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003estash-\u003edrop('stash@{0}');\n```\n\n#### $git-\u003estash-\u003epop(_string_ $stash = null, _array_ $options = [])\n\nRemove a single stashed state from the stash list and apply it on top of the current working tree state\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003estash-\u003epop('stash@{0}');\n```\n\n#### $git-\u003estash-\u003eapply(_string_ $stash = null, _array_ $options = [])\n\nLike pop, but do not remove the state from the stash list\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003estash-\u003eapply('stash@{0}');\n```\n\n#### $git-\u003estash-\u003ebranch(_string_ $name, _string_ $stash = null)\n\nCreates and checks out a new branch named \u003cbranchname\u003e starting from the commit at which the \u003cstash\u003e was originally created, applies the changes recorded in \u003cstash\u003e to the new working tree and index\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003estash-\u003ebranch('hotfix', 'stash@{0}');\n```\n\n#### $git-\u003estash-\u003eclear()\n\nRemove all the stashed states\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003estash-\u003eclear();\n```\n\n#### $git-\u003estash-\u003ecreate()\n\nCreate a stash (which is a regular commit object) and return its object name, without storing it anywhere in the ref namespace\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$commit = $git-\u003estash-\u003ecreate();\n```\n\n##### Output Example\n\n```\n877316ea6f95c43b7ccc2c2a362eeedfa78b597d\n```\n\n* * * * *\n\n### git status\n\n#### $git-\u003estatus(_array_ $options = [])\n\nReturns the working tree status\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$status = $git-\u003estatus();\n```\n\n##### Constants\n\n- StatusCommand::UNMODIFIED            [=' '] unmodified\n- StatusCommand::MODIFIED              [='M'] modified\n- StatusCommand::ADDED                 [='A'] added\n- StatusCommand::DELETED               [='D'] deleted\n- StatusCommand::RENAMED               [='R'] renamed\n- StatusCommand::COPIED                [='C'] copied\n- StatusCommand::UPDATED_BUT_UNMERGED  [='U'] updated but unmerged\n- StatusCommand::UNTRACKED             [='?'] untracked\n- StatusCommand::IGNORED               [='!'] ignored\n\n##### Output Example\n\n``` php\n[\n    'branch' =\u003e 'master',\n    'changes' =\u003e [\n        ['file' =\u003e 'item1.txt', 'index' =\u003e 'A', 'work_tree' =\u003e 'M'],\n        ['file' =\u003e 'item2.txt', 'index' =\u003e 'A', 'work_tree' =\u003e ' '],\n        ['file' =\u003e 'item3.txt', 'index' =\u003e '?', 'work_tree' =\u003e '?'],\n    ]\n]\n```\n\n##### Options\n\n- **ignored** (_boolean_) Show ignored files as well\n\n* * * * *\n\n### git tag\n\n#### $git-\u003etag()\n\nReturns an array of tags\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003eclone('https://github.com/kzykhys/PhpGit.git', '/path/to/repo');\n$git-\u003esetRepository('/path/to/repo');\n$tags = $git-\u003etag();\n```\n\n##### Output Example\n\n```\n['v1.0.0', 'v1.0.1', 'v1.0.2']\n```\n\n#### $git-\u003etag-\u003ecreate(_string_ $tag, _string_ $commit = null, _array_ $options = [])\n\nCreates a tag object\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003esetRepository('/path/to/repo');\n$git-\u003etag-\u003ecreate('v1.0.0');\n```\n\n##### Options\n\n- **annotate** (_boolean_) Make an unsigned, annotated tag object\n- **sign**     (_boolean_) Make a GPG-signed tag, using the default e-mail address’s key\n- **force**    (_boolean_) Replace an existing tag with the given name (instead of failing)\n\n#### $git-\u003etag-\u003edelete(_string|array|\\Traversable_ $tag)\n\nDelete existing tags with the given names\n\n#### $git-\u003etag-\u003everify(_string|array|\\Traversable_ $tag)\n\nVerify the gpg signature of the given tag names\n\n* * * * *\n\n### git ls-tree\n\n#### $git-\u003etree(_string_ $branch = master, _string_ $path = '')\n\nReturns the contents of a tree object\n\n``` php\n$git = new PhpGit\\Git();\n$git-\u003eclone('https://github.com/kzykhys/PhpGit.git', '/path/to/repo');\n$git-\u003esetRepository('/path/to/repo');\n$tree = $git-\u003etree('master');\n```\n\n##### Output Example\n\n``` php\n[\n    ['mode' =\u003e '100644', 'type' =\u003e 'blob', 'hash' =\u003e '1f100ce9855b66111d34b9807e47a73a9e7359f3', 'file' =\u003e '.gitignore', 'sort' =\u003e '2:.gitignore'],\n    ['mode' =\u003e '100644', 'type' =\u003e 'blob', 'hash' =\u003e 'e0bfe494537037451b09c32636c8c2c9795c05c0', 'file' =\u003e '.travis.yml', 'sort' =\u003e '2:.travis.yml'],\n    ['mode' =\u003e '040000', 'type' =\u003e 'tree', 'hash' =\u003e '8d5438e79f77cd72de80c49a413f4edde1f3e291', 'file' =\u003e 'bin', 'sort' =\u003e '1:.bin'],\n]\n```\n\nLicense\n-------\n\nThe MIT License\n\nAuthor\n------\n\nDeveloped by Kazuyuki Hayashi (@kzykhys), Maintained by @inhere\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphppkg%2Fphpgit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphppkg%2Fphpgit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphppkg%2Fphpgit/lists"}