Skip to content

Conversation

@ankddev
Copy link
Contributor

@ankddev ankddev commented Aug 19, 2025

Fixes #8372

Description

Improve docs of gh release create to distinguish difference between --generate-notes and --notes-from-tag flags.

Showcase

$ ./bin/gh release create --help
Create a new GitHub Release for a repository.

A list of asset files may be given to upload to the new release. To define a
display label for an asset, append text starting with `#` after the file name.

If a matching git tag does not yet exist, one will automatically get created
from the latest state of the default branch.
Use `--target` to point to a different branch or commit for the automatic tag creation.
Use `--verify-tag` to abort the release if the tag doesn't already exist.
To fetch the new tag locally after the release, do `git fetch --tags origin`.

To create a release from an annotated git tag, first create one locally with
git, push the tag to GitHub, then run this command.
Use `--notes-from-tag` to get the release notes
from the annotated git tag.
It will use annotation of git tag if it is annotated, associated with tag commit's message otherwise.

Use `--generate-notes` to automatically generate notes using GitHub Release Notes API.
When using automatically generated release notes, a release title will also be automatically
generated unless a title was explicitly passed. Additional release notes can be prepended to
automatically generated notes by using the `--notes` flag.

By default, the release is created even if there are no new commits since the last release.
This may result in the same or duplicate release which may not be desirable in some cases.
Use `--fail-on-no-commits` to fail if no new commits are available. This flag has no
effect if there are no existing releases or this is the very first release.


USAGE
  gh release create [<tag>] [<filename>... | <pattern>...]

ALIASES
  gh release new

FLAGS
      --discussion-category string   Start a discussion in the specified category
  -d, --draft                        Save the release as a draft instead of publishing it
      --fail-on-no-commits           Fail if there are no commits since the last release (no impact on the first release)
      --generate-notes               Automatically generate title and notes for the release via GitHub Release Notes API
      --latest                       Mark this release as "Latest" (default [automatic based on date and version]). --latest=false to explicitly NOT set as latest
  -n, --notes string                 Release notes
  -F, --notes-file file              Read release notes from file (use "-" to read from standard input)
      --notes-from-tag               Fetch notes from the tag annotation or message of commit associated with tag
      --notes-start-tag string       Tag to use as the starting point for generating release notes
  -p, --prerelease                   Mark the release as a prerelease
      --target branch                Target branch or full commit SHA (default [main branch])
  -t, --title string                 Release title
      --verify-tag                   Abort in case the git tag doesn't already exist in the remote repository

INHERITED FLAGS
      --help                     Show help for command
  -R, --repo [HOST/]OWNER/REPO   Select another repository using the [HOST/]OWNER/REPO format

EXAMPLES
  # Interactively create a release
  $ gh release create

  # Interactively create a release from specific tag
  $ gh release create v1.2.3

  # Non-interactively create a release
  $ gh release create v1.2.3 --notes "bugfix release"

  # Use automatically generated via GitHub Release Notes API release notes
  $ gh release create v1.2.3 --generate-notes

  # Use release notes from a file
  $ gh release create v1.2.3 -F release-notes.md

  # Use tag annotation or associated commit message as notes
  $ gh release create v1.2.3 --notes-from-tag

  # Don't mark the release as latest
  $ gh release create v1.2.3 --latest=false

  # Upload all tarballs in a directory as release assets
  $ gh release create v1.2.3 ./dist/*.tgz

  # Upload a release asset with a display label
  $ gh release create v1.2.3 '/path/to/asset.zip#My display label'

  # Create a release and start a discussion
  $ gh release create v1.2.3 --discussion-category "General"

  # Create a release only if there are new commits available since the last release
  $ gh release create v1.2.3 --fail-on-no-commits

LEARN MORE
  Use `gh <command> <subcommand> --help` for more information about a command.
  Read the manual at https://cli.github.com/manual
  Learn about exit codes using `gh help exit-codes`
  Learn about accessibility experiences using `gh help accessibility`

…s' and '--notes-from-tag'

Signed-off-by: Andrey <andrekabatareika@gmail.com>
@ankddev ankddev requested a review from a team as a code owner August 19, 2025 15:46
@ankddev ankddev requested a review from williammartin August 19, 2025 15:46
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Aug 19, 2025
@BagToad BagToad self-requested a review August 25, 2025 15:01
Updated help text to specify that if a git tag is not annotated, the release notes will use the commit message instead of the tag annotation.
Copy link
Member

@BagToad BagToad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I pushed a small rewording in e04c50e, but everything else looks good!

@BagToad BagToad enabled auto-merge (squash) August 25, 2025 15:10
@BagToad BagToad merged commit 204536c into cli:trunk Aug 25, 2025
10 of 11 checks passed
@ankddev ankddev deleted the docs-release-notes branch August 25, 2025 15:55
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Sep 12, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cli/cli](https://github.com/cli/cli) | minor | `v2.78.0` -> `v2.79.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>cli/cli (cli/cli)</summary>

### [`v2.79.0`](https://github.com/cli/cli/releases/tag/v2.79.0): GitHub CLI 2.79.0

[Compare Source](cli/cli@v2.78.0...v2.79.0)

#### Advanced Issue Search Support

The GitHub CLI now supports advanced issue search syntax using:

- Searching issues: `gh search issues <advanced issue search query>`
- Searching pull requests: `gh search prs <advanced issue search query>`
- While listing issues: `gh issue list --search <advanced issue search query>`
- While listing pull requests: `gh pr list --search <advanced issue search query>`

For more information about advanced issue search syntax, see: "[Filtering and Searching Issues and Merge Requests](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/filtering-and-searching-issues-and-pull-requests#building-advanced-filters-for-issues)"

#### Copy OAuth Code Automatically

The GitHub CLI now supports writing the OAuth one-time pass code to the clipboard automatically during authentication:

- While logging in: `gh auth login --clipboard` / `gh auth login -c`
- While refreshing the token: `gh auth refresh --clipboard` / `gh auth refresh -c`

#### What's Changed

##### ✨ Features

- feat: `gh auth` Automatically copy one-time OAuth code to clipboard by [@&#8203;ankddev](https://github.com/ankddev) in [#&#8203;11518](cli/cli#11518)
- feat: add support for `--ref` in `gh cache delete` by [@&#8203;luxass](https://github.com/luxass) in [#&#8203;11592](cli/cli#11592)
- Use advanced issue search by [@&#8203;babakks](https://github.com/babakks) in [#&#8203;11638](cli/cli#11638)

##### 📚 Docs & Chores

- docs(release create): difference `--generate-notes` and `--notes-from-tag` by [@&#8203;ankddev](https://github.com/ankddev) in [#&#8203;11534](cli/cli#11534)
- refactor tests: use `slices.Equal` to simplify code by [@&#8203;minxinyi](https://github.com/minxinyi) in [#&#8203;11364](cli/cli#11364)
- Remove mention of public preview in trustedroot.go by [@&#8203;jkylekelly](https://github.com/jkylekelly) in [#&#8203;11652](cli/cli#11652)

##### :dependabot: Dependencies

- Bump sigstore/rekor to v1.4.1 by [@&#8203;BagToad](https://github.com/BagToad) in [#&#8203;11654](cli/cli#11654)
- chore(deps): bump actions/stale from 9 to 10 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;11663](cli/cli#11663)
- chore(deps): bump actions/setup-go from 5 to 6 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;11662](cli/cli#11662)

#### New Contributors

- [@&#8203;minxinyi](https://github.com/minxinyi) made their first contribution in [#&#8203;11364](cli/cli#11364)
- [@&#8203;jkylekelly](https://github.com/jkylekelly) made their first contribution in [#&#8203;11652](cli/cli#11652)
- [@&#8203;luxass](https://github.com/luxass) made their first contribution in [#&#8203;11592](cli/cli#11592)

**Full Changelog**: <cli/cli@v2.78.0...v2.79.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45OC4xIiwidXBkYXRlZEluVmVyIjoiNDEuOTguMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve documentation to distinguish between gh release create --notes-from-tag and --generate-notes

3 participants