GitButler ⧓

GuidesCLI Tutorial

Scripting

How to script with GitButler CLI

JSON Errwhere

All of the commands are designed to be very user friendly when we have an interactive terminal, but you can also very easily script everything by passing the --json or -j option to anything. For example, here is using but show on a commit.

$ but show 2672465
Commit:    26724656b8856871542da1e69c888b2e7330294a
Change-ID: pzyoupplvookqoqpussrpnnlrwqsnzkr
Author:    Scott Chacon <schacon@gmail.com>
Date:      2026-02-04 07:22:53 +0100 (9h ago)

hero update - new branding

Files changed:
  M app/models/user.rb
  M app/views/home/index.html.erb
  A test.md

Now with the --json option:

$ but show --json 2672465 | jq
{
  "commit": "26724656b8856871542da1e69c888b2e7330294a",
  "author": {
    "name": "Scott Chacon",
    "email": "schacon@gmail.com"
  },
  "committer": {
    "name": "Scott Chacon",
    "email": "schacon@gmail.com"
  },
  "date": "2026-02-04 07:22:53 +0100",
  "message": "hero update - new branding\n",
  "files": [
    {
      "path": "app/models/user.rb",
      "status": "modified"
    },
    {
      "path": "app/views/home/index.html.erb",
      "status": "modified"
    },
    {
      "path": "test.md",
      "status": "added"
    }
  ],
  "changeId": "pzyoupplvookqoqpussrpnnlrwqsnzkr"
}

You can do this with anything - committing, status, diffing, etc. Just throw a -j in there and you get parseable data (or, data your agent can very easily work with).

Last updated on

On this page

Edit on GitHubGive us feedback