{"id":15653281,"url":"https://github.com/int128/ghcp","last_synced_at":"2026-02-21T03:03:31.698Z","repository":{"id":38231117,"uuid":"173228257","full_name":"int128/ghcp","owner":"int128","description":"Tool to fork a repository, commit files, create a pull request and upload assets using GitHub API","archived":false,"fork":false,"pushed_at":"2025-04-05T18:20:36.000Z","size":809,"stargazers_count":39,"open_issues_count":9,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T19:25:07.176Z","etag":null,"topics":["github-api","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/int128.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}},"created_at":"2019-03-01T03:26:18.000Z","updated_at":"2025-04-01T19:07:10.000Z","dependencies_parsed_at":"2024-08-06T21:55:11.923Z","dependency_job_id":"1907f3a2-39c7-4ef6-b2a0-a57ed77abde1","html_url":"https://github.com/int128/ghcp","commit_stats":{"total_commits":188,"total_committers":4,"mean_commits":47.0,"dds":0.4308510638297872,"last_synced_commit":"6de98923653dac599f0cc0e53dc805a9c963669e"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fghcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fghcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fghcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fghcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/int128","download_url":"https://codeload.github.com/int128/ghcp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248814528,"owners_count":21165781,"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":["github-api","golang"],"created_at":"2024-10-03T12:45:12.617Z","updated_at":"2026-02-21T03:03:31.693Z","avatar_url":"https://github.com/int128.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ghcp [![go](https://github.com/int128/ghcp/actions/workflows/go.yaml/badge.svg)](https://github.com/int128/ghcp/actions/workflows/go.yaml) [![GoDoc](https://godoc.org/github.com/int128/ghcp?status.svg)](https://godoc.org/github.com/int128/ghcp)\n\nThis is a release engineering tool for GitHub.\nIt depends on GitHub APIs and works without git installation.\n\nIt provides the following features:\n\n- Commit files to a repository\n- Create an empty commit\n- Fork a repository and commit files to the forked repository\n- Create a pull request\n- Upload files to GitHub Releases\n\n\n## Getting Started\n\nYou can install the latest release from [GitHub Releases](https://github.com/int128/ghcp/releases) or Homebrew.\n\n```sh\n# GitHub Releases\ncurl -fL -o /tmp/ghcp.zip https://github.com/int128/ghcp/releases/download/v1.8.0/ghcp_linux_amd64.zip\nunzip /tmp/ghcp.zip -d ~/bin\n\n# Homebrew\nbrew install int128/ghcp/ghcp\n```\n\nYou need to get a personal access token from the [settings](https://github.com/settings/tokens) and set it to `GITHUB_TOKEN` environment variable or `--token` option.\n\n\n### Commit files to a branch\n\nTo commit files to the default branch:\n\n```sh\nghcp commit -r OWNER/REPO -m MESSAGE file1 file2\n```\n\nTo commit files to `feature` branch:\n\n```sh\nghcp commit -r OWNER/REPO -b feature -m MESSAGE file1 file2\n```\n\nIf `feature` branch does not exist, ghcp will create it from the default branch.\n\nTo create `feature` branch from `develop` branch:\n\n```sh\nghcp commit -r OWNER/REPO -b feature --parent=develop -m MESSAGE file1 file2\n```\n\nIf `feature` branch already exists, ghcp will fail.\nCurrently only fast-forward is supported.\n\nghcp performs a commit operation as follows:\n\n- An author and committer of a commit are set to the login user (depending on the token).\n- If the branch has same files, do not create a new commit. It prevents an empty commit.\n- It excludes `.git` directories.\n- It does not support `.gitconfig`.\n\nYou can set the following options.\n\n```\nFlags:\n      --author-email string      Author email (default: login email)\n      --author-name string       Author name (default: login name)\n  -b, --branch string            Name of the branch to create or update (default: the default branch of repository)\n      --committer-email string   Committer email (default: login email)\n      --committer-name string    Committer name (default: login name)\n      --dry-run                  Upload files but do not update the branch actually\n  -h, --help                     help for commit\n  -m, --message string           Commit message (mandatory)\n      --no-file-mode             Ignore executable bit of file and treat as 0644\n      --no-parent                Create a commit without a parent\n  -u, --owner string             Repository owner\n      --parent string            Create a commit from the parent branch/tag (default: fast-forward)\n  -r, --repo string              Repository name, either -r OWNER/REPO or -u OWNER -r REPO (mandatory)\n```\n\n\n### Create an empty commit to a branch\n\nTo create an empty commit to the default branch:\n\n```sh\nghcp empty-commit -r OWNER/REPO -m MESSAGE\n```\n\nTo create an empty commit to the branch:\n\n```sh\nghcp empty-commit -r OWNER/REPO -b BRANCH -m MESSAGE\n```\n\nIf the branch does not exist, ghcp creates a branch from the default branch.\nIt the branch exists, ghcp updates the branch by fast-forward.\n\nTo create an empty commit to a new branch from the parent branch:\n\n```sh\nghcp empty-commit -r OWNER/REPO -b BRANCH --parent PARENT -m MESSAGE\n```\n\nIf the branch exists, it will fail.\n\nYou can set the following options.\n\n```\nFlags:\n      --author-email string      Author email (default: login email)\n      --author-name string       Author name (default: login name)\n  -b, --branch string            Name of the branch to create or update (default: the default branch of repository)\n      --committer-email string   Committer email (default: login email)\n      --committer-name string    Committer name (default: login name)\n      --dry-run                  Do not update the branch actually\n  -h, --help                     help for empty-commit\n  -m, --message string           Commit message (mandatory)\n  -u, --owner string             Repository owner\n      --parent string            Create a commit from the parent branch/tag (default: fast-forward)\n  -r, --repo string              Repository name, either -r OWNER/REPO or -u OWNER -r REPO (mandatory)\n```\n\n\n### Fork the repository and commit files to a new branch\n\nTo fork repository `UPSTREAM/REPO` and create `feature` branch from the default branch:\n\n```sh\nghcp fork-commit -u UPSTREAM/REPO -b feature -m MESSAGE file1 file2\n```\n\nTo fork repository `UPSTREAM/REPO` and create `feature` branch from `develop` branch of the upstream:\n\n```sh\nghcp fork-commit -u UPSTREAM/REPO -b feature --parent develop -m MESSAGE file1 file2\n```\n\nIf the branch already exists, ghcp will fail.\nCurrently only fast-forward is supported.\n\nYou can set the following options.\n\n```\nFlags:\n      --author-email string      Author email (default: login email)\n      --author-name string       Author name (default: login name)\n  -b, --branch string            Name of the branch to create (mandatory)\n      --committer-email string   Committer email (default: login email)\n      --committer-name string    Committer name (default: login name)\n      --dry-run                  Upload files but do not update the branch actually\n  -h, --help                     help for fork-commit\n  -m, --message string           Commit message (mandatory)\n      --no-file-mode             Ignore executable bit of file and treat as 0644\n  -u, --owner string             Upstream repository owner\n      --parent string            Upstream branch name (default: the default branch of the upstream repository)\n  -r, --repo string              Upstream repository name, either -r OWNER/REPO or -u OWNER -r REPO (mandatory)\n```\n\n\n### Create a pull request\n\nTo create a pull request from `feature` branch to the default branch:\n\n```sh\nghcp pull-request -r OWNER/REPO -b feature --title TITLE --body BODY\n```\n\nTo create a pull request from `feature` branch to the `develop` branch:\n\n```sh\nghcp pull-request -r OWNER/REPO -b feature --base develop --title TITLE --body BODY\n```\n\nTo create a pull request from `feature` branch of `OWNER/REPO` repository to the default branch of `UPSTREAM/REPO` repository:\n\n```sh\nghcp pull-request -r OWNER/REPO -b feature --base-repo UPSTREAM/REPO --title TITLE --body BODY\n```\n\nTo create a pull request from `feature` branch of `OWNER/REPO` repository to the default branch of `UPSTREAM/REPO` repository:\n\n```sh\nghcp pull-request -r OWNER/REPO -b feature --base-repo UPSTREAM/REPO --base feature --title TITLE --body BODY\n```\n\nIf an open pull request already exists, ghcp does nothing.\n\nYou can set the following options.\n\n```\nFlags:\n      --base string         Base branch name (default: default branch of base repository)\n      --base-owner string   Base repository owner (default: head)\n      --base-repo string    Base repository name, either --base-repo OWNER/REPO or --base-owner OWNER --base-repo REPO (default: head)\n      --body string         Body of a pull request\n      --draft               If set, mark as a draft\n  -b, --head string         Head branch name (mandatory)\n  -u, --head-owner string   Head repository owner\n  -r, --head-repo string    Head repository name, either -r OWNER/REPO or -u OWNER -r REPO (mandatory)\n  -h, --help                help for pull-request\n      --reviewer string     If set, request a review\n      --title string        Title of a pull request (mandatory)\n```\n\n\n### Release assets\n\nTo upload files to the release associated to tag `v1.0.0`:\n\n```sh\nghcp release -r OWNER/REPO -t v1.0.0 dist/\n```\n\nIf the release does not exist, it will create a release.\nIf the tag does not exist, it will create a tag from the default branch and create a release.\n\nTo create a tag and release on commit `COMMIT_SHA` and upload files to the release:\n\n```sh\nghcp release -r OWNER/REPO -t v1.0.0 --target COMMIT_SHA dist/\n```\n\nIf the tag already exists, it ignores the target commit.\nIf the release already exist, it only uploads the files.\n\nYou can set the following options.\n\n```\nFlags:\n      --dry-run         Do not create a release and assets actually\n  -h, --help            help for release\n  -u, --owner string    Repository owner\n  -r, --repo string     Repository name, either -r OWNER/REPO or -u OWNER -r REPO (mandatory)\n  -t, --tag string      Tag name (mandatory)\n      --target string   Branch name or commit SHA of a tag. Unused if the Git tag already exists (default: the default branch)\n```\n\n\n## Usage\n\n### Global options\n\nYou can set the following options.\n\n```\nGlobal Flags:\n      --api string         GitHub API v3 URL (v4 will be inferred) [$GITHUB_API]\n      --debug              Show debug logs\n  -C, --directory string   Change to directory before operation\n      --token string       GitHub API token [$GITHUB_TOKEN]\n```\n\n### GitHub Enterprise\n\nYou can set a GitHub API v3 URL by `GITHUB_API` environment variable or `--api` option.\n\n```sh\nexport GITHUB_API=https://github.example.com/api/v3/\n```\n\nGitHub API v4 URL will be automatically inferred from the v3 URL by resolving the relative path `../graphql`.\n\n\n## Contributions\n\nThis is an open source software.\nFeel free to open issues and pull requests.\n\nAuthor: [Hidetake Iwata](https://github.com/int128)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fint128%2Fghcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fint128%2Fghcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fint128%2Fghcp/lists"}