usage

GitHub CLI 2.99.0

工具與目錄
在這頁

新功能 2 項

01

在命令列直接把截圖和影片附進 issue 與 PR

⟦你把沖洗好的照片一張張貼進日誌本,寫到哪一頁就貼在哪一頁;頁面上原本寫著「照片放這裡」的位置,照片會直接蓋上去,其他頁則往後補貼。⟧回報問題時想附一張截圖,以前得先開網頁上傳。現在 gh 多了 --attach,直接把本機的圖片和影片傳上去,接進 issue、pull request 或留言的內文。

```shell gh issue create --attach './repro.png#The error state' gh pr comment 456 --attach ./result.mp4 ```

內文若已經寫到那個本機路徑,gh 會把它換成上傳後的網址;沒寫到就補在最後。同一次指令要附多個檔案,就重複寫幾次這個旗標。這功能在 GitHub.com 與 GitHub Enterprise Cloud 上都能用。

官方原文

## Attach images and videos to issues and pull requests

The repeatable --attach flag uploads local images and videos and adds them to issue, pull request, or comment bodies. If a body already references the local path, gh replaces it with the uploaded URL; otherwise it appends the attachment:

```shell

# Attach files when creating or editing an issue

gh issue create --attach './repro.png#The error state'

gh issue edit 123 --attach ./walkthrough.mp4

# Attach files when creating or editing a pull request

gh pr create --attach ./before.png

gh pr edit 456 --attach ./after.png

# Attach files to comments

gh issue comment 123 --attach ./repro.png

gh pr comment 456 --attach ./result.mp4

```

Repeat the flag to attach multiple files in a single invocation. Attachments are available on GitHub.com and GitHub Enterprise Cloud.

For more information see https://gh.io/gh-attach and https://github.blog/changelog/2026-09-01-github-cli-media-in-issues-pull-requests-and-comments/

02

gh issue develop 能另開工作目錄,手上的東西不用收

手邊的改動改到一半,issue 那頭又要你開一條新分支——以前得先收拾現場才能切過去。現在 gh issue develop 可以幫 issue 建好連動的分支,並且把它簽出到一個新的 Git worktree(工作樹,讓同一專案平行開多份副本的功能),你目前這份工作目錄原封不動。

```shell gh issue develop 123 --checkout --worktree /path/to/wt-feature ```

打個比方

工地要趕另一項工程時,不必把現場拆掉重排,而是在旁邊另闢一塊作業區,兩邊同時進行。

官方原文

## Worktree support extended to gh issue develop

gh issue develop can now create a linked branch and check it out in a new Git worktree, leaving your current working copy unchanged:

```shell

# Create a linked branch for an issue and check it out in a worktree

gh issue develop 123 --checkout --worktree /path/to/wt-feature

```