{"id":15755009,"url":"https://github.com/sweetchuck/robo-git","last_synced_at":"2025-07-19T03:04:37.053Z","repository":{"id":11734316,"uuid":"70397466","full_name":"Sweetchuck/robo-git","owner":"Sweetchuck","description":"Git related Robo tasks","archived":false,"fork":false,"pushed_at":"2024-12-17T21:06:57.000Z","size":481,"stargazers_count":3,"open_issues_count":4,"forks_count":0,"subscribers_count":4,"default_branch":"4.x","last_synced_at":"2025-07-04T15:24:11.553Z","etag":null,"topics":["git","robo","robo-tasks"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sweetchuck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-10-09T11:02:27.000Z","updated_at":"2024-12-17T17:40:04.000Z","dependencies_parsed_at":"2024-06-21T17:51:06.860Z","dependency_job_id":"4ded43d5-fc88-4e36-9914-9e6223e2c632","html_url":"https://github.com/Sweetchuck/robo-git","commit_stats":{"total_commits":61,"total_committers":3,"mean_commits":"20.333333333333332","dds":0.4918032786885246,"last_synced_commit":"dbdea58d898a06db0af26ff595ce433c70a98893"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/Sweetchuck/robo-git","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sweetchuck%2Frobo-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sweetchuck%2Frobo-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sweetchuck%2Frobo-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sweetchuck%2Frobo-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sweetchuck","download_url":"https://codeload.github.com/Sweetchuck/robo-git/tar.gz/refs/heads/4.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sweetchuck%2Frobo-git/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265879129,"owners_count":23843070,"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","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":["git","robo","robo-tasks"],"created_at":"2024-10-04T08:06:25.279Z","updated_at":"2025-07-19T03:04:37.027Z","avatar_url":"https://github.com/Sweetchuck.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Robo task wrapper for Git commands\n\n[![CircleCI](https://circleci.com/gh/Sweetchuck/robo-git/tree/4.x.svg?style=svg)](https://circleci.com/gh/Sweetchuck/robo-git/tree/4.x)\n[![codecov](https://codecov.io/gh/Sweetchuck/robo-git/branch/4.x/graph/badge.svg)](https://codecov.io/gh/Sweetchuck/robo-git)\n\nThe main additional feature compare to the ::taskExec() is that this tasks parse\nthe stdOutput/stdError and make the result available for the next tasks by\nputting it into the `\\Robo\\State\\Data` instance which belongs to the pipeline.\n\n\n## Install\n\nRun `composer require --dev sweetchuck/robo-git`\n\n\n## Task - taskGitBranchList()\n\n```php\n\u003c?php\n\ndeclare(strict_types = 1);\n\nclass RoboFileExample extends \\Robo\\Tasks\n{\n    use \\Sweetchuck\\Robo\\Git\\GitTaskLoader;\n\n    public function gitBranches(string $dir = '.')\n    {\n        return $this\n            -\u003ecollectionBuilder()\n            -\u003eaddTask(\n                $this\n                    -\u003etaskGitBranchList()\n                    -\u003esetWorkingDirectory($dir)\n                    // Available options:\n                    // --all\n                    // --color\n                    // --contains\n                    // --format\n                    // --list\n                    // --merged\n                    // --points-at\n                    // --sort\n            )\n            -\u003eaddCode(function (\\Robo\\State\\Data $data): int {\n                // Here you can do whatever you want with the branches.\n                $output = $this-\u003eoutput();\n                foreach ($data['gitBranches'] as $longName =\u003e $branch) {\n                    $output-\u003ewriteln($longName);\n                    foreach ($branch as $key =\u003e $value) {\n                        $output-\u003ewriteln(\"    $key = \" . var_export($value, true));\n                    }\n                }\n\n                return 0;\n            });\n    }\n}\n```\n\nRun: `$ vendor/bin/robo git:branches`\n\nExample output:\n\u003e \u003cpre\u003erefs/heads/1.x\n\u003e     isCurrentBranch = true\n\u003e     push = 'refs/remotes/upstream/1.x'\n\u003e     push.short = 'upstream/1.x'\n\u003e     refName = 'refs/heads/1.x'\n\u003e     refName.short = '1.x'\n\u003e     track = ''\n\u003e     track.ahead = NULL\n\u003e     track.behind = NULL\n\u003e     track.gone = false\n\u003e     upstream = 'refs/remotes/upstream/1.x'\n\u003e     upstream.short = 'upstream/1.x'\u003c/pre\u003e\n\n\n## Task - taskGitConfigGet()\n\n```php\n\u003c?php\n\ndeclare(strict_types = 1);\n\nclass RoboFileExample extends \\Robo\\Tasks\n{\n    use \\Sweetchuck\\Robo\\Git\\GitTaskLoader;\n\n    /**\n     * @command git:config:get\n     */\n    public function gitConfigGet(string $name)\n    {\n        return $this\n            -\u003ecollectionBuilder()\n            -\u003eaddTask(\n                $this\n                    -\u003etaskGitConfigGet()\n                    -\u003esetName($name)\n            )\n            -\u003eaddCode(function (\\Robo\\State\\Data $data) use ($name): int {\n                $key = \"git.config.$name\";\n                $this-\u003eoutput()-\u003ewriteln(\"$key = {$data[$key]}\");\n\n                return 0;\n            });\n    }\n}\n```\n\nRun: `$ vendor/bin/robo git:config:get`\n\nExample output:\n\u003e `git.config.user.name = Andor`\n\n## Task - taskGitCurrentBranch()\n\n```php\n\u003c?php\n\ndeclare(strict_types = 1);\n\nclass RoboFileExample extends \\Robo\\Tasks\n{\n    use \\Sweetchuck\\Robo\\Git\\GitTaskLoader;\n\n    /**\n     * @command git:current-branch\n     */\n    public function gitCurrentBranch()\n    {\n        return $this\n            -\u003ecollectionBuilder()\n            -\u003eaddTask($this-\u003etaskGitCurrentBranch())\n            -\u003eaddCode(function (\\Robo\\State\\Data $data): int {\n                $this-\u003eoutput()-\u003ewriteln(\"long = {$data['gitCurrentBranch.long']}\");\n                $this-\u003eoutput()-\u003ewriteln(\"short = {$data['gitCurrentBranch.short']}\");\n\n                return 0;\n            });\n    }\n}\n```\n\nRun: `$ vendor/bin/robo git:current-branch`\n\nExample output:\n\u003e long = refs/heads/1.x\u003cbr /\u003e\n\u003e short = 1.x\n\n\n## Task - taskGitListFiles()\n\n```php\n\u003c?php\n\ndeclare(strict_types = 1);\n\nclass RoboFileExample extends \\Robo\\Tasks\n{\n    use \\Sweetchuck\\Robo\\Git\\GitTaskLoader;\n\n    /**\n     * @command git:list-files\n     */\n    public function gitListFiles()\n    {\n        return $this\n            -\u003ecollectionBuilder()\n            -\u003eaddTask(\n                $this\n                    -\u003etaskGitListFiles()\n                    -\u003esetPaths(['R*.md'])\n                    // Available options:\n                    // -t\n                    // -v\n                    // -z\n                    // --cached\n                    // --deleted\n                    // --directory\n                    // --empty-directory\n                    // --eol\n                    // --exclude\n                    // --exclude-file\n                    // --full-name\n                    // --killed\n                    // --ignored\n                    // --modified\n                    // --others\n                    // --stage\n                    // --resolve-undo\n                    // --unmerged\n            )\n            -\u003eaddCode(function (\\Robo\\State\\Data $data): int {\n                $output = $this-\u003eoutput();\n                /** * @var \\Sweetchuck\\Robo\\Git\\ListFilesItem $file */\n                foreach ($data['files'] as $filePath =\u003e $file) {\n                    $output-\u003ewriteln($filePath);\n                    $output-\u003ewriteln('    status = ' . var_export($file-\u003estatus, true));\n                    $output-\u003ewriteln('    objectName = ' . var_export($file-\u003eobjectName, true));\n                    $output-\u003ewriteln('    eolInfoI = ' . var_export($file-\u003eeolInfoI, true));\n                    $output-\u003ewriteln('    eolInfoW = ' . var_export($file-\u003eeolInfoW, true));\n                    $output-\u003ewriteln('    eolAttr = ' . var_export($file-\u003eeolAttr, true));\n                    $output-\u003ewriteln('    fileName = ' . var_export($file-\u003efileName, true));\n                }\n\n                return 0;\n            });\n    }\n}\n```\n\nRun: `$ vendor/bin/robo git:list-files`\n\nExample output:\n\u003e \u003cpre\u003eREADME.md\n\u003e     status = NULL\n\u003e     objectName = NULL\n\u003e     eolInfoI = NULL\n\u003e     eolInfoW = NULL\n\u003e     eolAttr = NULL\n\u003e     fileName = 'README.md'\u003c/pre\u003e\n\n\n## Task - taskGitListChangedFiles()\n\n@todo\n\n\n## Task - taskGitListStagedFiles()\n\n@todo\n\n\n## Task - taskGitNumOfCommitsBetween()\n\n@todo\n\n\n## Task - taskGitReadStagedFiles()\n\n@todo\n\n\n## Task - taskGitRemoteList()\n\n@todo\n\n\n## Task - taskGitStatus()\n\n@todo\n\n\n## Task - taskGitTagList()\n\n@todo\n\n\n## Task - taskGitTopLevel()\n\n@todo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsweetchuck%2Frobo-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsweetchuck%2Frobo-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsweetchuck%2Frobo-git/lists"}