Scroll to navigation

GT-COMMIT-DIFF(1) gitea-cli Manual GT-COMMIT-DIFF(1)

NAME

gt-commit-diff - Show the changes of a commit

SYNOPSIS

gt commit diff <ref> [flags]

DESCRIPTION

Show the changes of a commit as a unified diff, the same way gt pr diff does.

On a terminal the diff is colored and paged. Piped, it is written unchanged, so that gt commit diff 3f2a9c1 | git apply works. --patch writes the patch that git am takes, with the message and author.

--path and --exclude narrow the diff to files, as the file tree of the web interface does, and --name-only, --name-status and --stat summarize it. Gitea's API has no options for what a diff contains, such as ignoring whitespace, so these work on the diff after gt has read it.

ARGUMENTS

A repository can be supplied as NAME (one of yours), OWNER/NAME, HOST/OWNER/NAME or a URL.
Without an argument, the repository of the current Git clone is used.

OPTIONS

--color="auto" Color the diff {auto|always|never}

-e, --exclude=[] Leave out files matching pattern, which is written like --path (repeatable)

-h, --help[=false] help for diff

--name-only[=false] List only the names of the changed files

--name-status[=false] List the changed files with A, M, D or R for how they changed

--patch[=false] Write the patch that git am takes, with the message and author

--path=[] Show only files matching pattern: a file, a directory/, or a glob such as '*.go' or 'internal/*/_test.go' (repeatable)

--stat[=false] Show how many lines each file changed, and the total, instead of the diff

-w, --web[=false] Open the commit in the browser

OPTIONS INHERITED FROM PARENT COMMANDS

--cwd="" Working directory for repository discovery

--debug[=false] Log the method, URL, status, and duration of each HTTP request to stderr

--host="" Gitea instance URL, including any base path

--interactive[=false] Allow prompts with machine output

--no-input[=false] Disable prompts and implicit editor/browser interactions

--remote="" Git remote used for repository discovery

-R, --repo="" Select a repository as OWNER/REPO or URL

--sudo="" Perform API requests as this user (requires an administrator account)

--user="" Account name on the selected instance

EXAMPLE

$ gt commit diff 3f2a9c1
$ gt commit diff v1.2.0 --stat
$ gt commit diff main --path 'internal/' --exclude '*_test.go'
$ gt commit diff 3f2a9c1 --patch > fix.patch

SEE ALSO

gt-commit(1)

Nov 2026 gitea-cli