If feature branch already exists, ghcp will fail.
Currently only fast-forward is supported.
ghcp performs a commit operation as follows:
An author and committer of a commit are set to the login user (depending on the token).
If the branch has same files, do not create a new commit. It prevents an empty commit.
It excludes .git directories.
It does not support .gitconfig.
You can set the following options.
Flags:
--author-email string Author email (default: login email)
--author-name string Author name (default: login name)
-b, --branch string Name of the branch to create or update (default: the default branch of repository)
--committer-email string Committer email (default: login email)
--committer-name string Committer name (default: login name)
--dry-run Upload files but do not update the branch actually
-h, --help help for commit
-m, --message string Commit message (mandatory)
--no-file-mode Ignore executable bit of file and treat as 0644
--no-parent Create a commit without a parent
-u, --owner string Repository owner
--parent string Create a commit from the parent branch/tag (default: fast-forward)
-r, --repo string Repository name, either -r OWNER/REPO or -u OWNER -r REPO (mandatory)
Flags:
--author-email string Author email (default: login email)
--author-name string Author name (default: login name)
-b, --branch string Name of the branch to create or update (default: the default branch of repository)
--committer-email string Committer email (default: login email)
--committer-name string Committer name (default: login name)
--dry-run Do not update the branch actually
-h, --help help for empty-commit
-m, --message string Commit message (mandatory)
-u, --owner string Repository owner
--parent string Create a commit from the parent branch/tag (default: fast-forward)
-r, --repo string Repository name, either -r OWNER/REPO or -u OWNER -r REPO (mandatory)
Fork the repository and commit files to a new branch
To fork repository UPSTREAM/REPO and create feature branch from the default branch:
If the branch already exists, ghcp will fail.
Currently only fast-forward is supported.
You can set the following options.
Flags:
--author-email string Author email (default: login email)
--author-name string Author name (default: login name)
-b, --branch string Name of the branch to create (mandatory)
--committer-email string Committer email (default: login email)
--committer-name string Committer name (default: login name)
--dry-run Upload files but do not update the branch actually
-h, --help help for fork-commit
-m, --message string Commit message (mandatory)
--no-file-mode Ignore executable bit of file and treat as 0644
-u, --owner string Upstream repository owner
--parent string Upstream branch name (default: the default branch of the upstream repository)
-r, --repo string Upstream repository name, either -r OWNER/REPO or -u OWNER -r REPO (mandatory)
Create a pull request
To create a pull request from feature branch to the default branch:
ghcp pull-request -r OWNER/REPO -b feature --title TITLE --body BODY
To create a pull request from feature branch to the develop branch:
ghcp pull-request -r OWNER/REPO -b feature --base develop --title TITLE --body BODY
To create a pull request from feature branch of OWNER/REPO repository to the default branch of UPSTREAM/REPO repository:
ghcp pull-request -r OWNER/REPO -b feature --base-repo UPSTREAM/REPO --title TITLE --body BODY
To create a pull request from feature branch of OWNER/REPO repository to the default branch of UPSTREAM/REPO repository:
ghcp pull-request -r OWNER/REPO -b feature --base-repo UPSTREAM/REPO --base feature --title TITLE --body BODY
If a pull request already exists, ghcp do nothing.
You can set the following options.
Flags:
--base string Base branch name (default: default branch of base repository)
--base-owner string Base repository owner (default: head)
--base-repo string Base repository name, either --base-repo OWNER/REPO or --base-owner OWNER --base-repo REPO (default: head)
--body string Body of a pull request
--draft If set, mark as a draft
-b, --head string Head branch name (mandatory)
-u, --head-owner string Head repository owner
-r, --head-repo string Head repository name, either -r OWNER/REPO or -u OWNER -r REPO (mandatory)
-h, --help help for pull-request
--reviewer string If set, request a review
--title string Title of a pull request (mandatory)
Release assets
To upload files to the release associated to tag v1.0.0:
ghcp release -r OWNER/REPO -t v1.0.0 dist/
If the release does not exist, it will create a release.
If the tag does not exist, it will create a tag from the default branch and create a release.
To create a tag and release on commit COMMIT_SHA and upload files to the release:
If the tag already exists, it ignores the target commit.
If the release already exist, it only uploads the files.
You can set the following options.
Flags:
--dry-run Do not create a release and assets actually
-h, --help help for release
-u, --owner string Repository owner
-r, --repo string Repository name, either -r OWNER/REPO or -u OWNER -r REPO (mandatory)
-t, --tag string Tag name (mandatory)
--target string Branch name or commit SHA of a tag. Unused if the Git tag already exists (default: the default branch)
Usage
Global options
You can set the following options.
Global Flags:
--api string GitHub API v3 URL (v4 will be inferred) [$GITHUB_API]
--debug Show debug logs
-C, --directory string Change to directory before operation
--token string GitHub API token [$GITHUB_TOKEN]
GitHub Enterprise
You can set a GitHub API v3 URL by GITHUB_API environment variable or --api option.
请发表评论