GitButler ⧓

Commands
>_

but commit

Commit changes to a stack.

The but commit command allows you to create a new commit on a specified branch (stack) with the current uncommitted changes.

If there is only one branch applied, it will commit to that branch by default.

If there are multiple branches applied, you must specify which branch to commit to, or if in interactive mode, you will be prompted to select one.

By default, all uncommitted changes and all changes already staged to that branch will be included in the commit. If you only want to commit the changes that are already staged to that branch, you can use the --only flag.

It will not commit changes staged to other branches.

Use but commit empty --before <target> or but commit empty --after <target> to insert a blank commit. This is useful for creating a placeholder commit that you can amend changes into later using but mark, but rub or but absorb.

Usage: but commit <COMMAND> [BRANCH] [OPTIONS]

Subcommands

but commit empty

Insert a blank commit before or after the specified commit.

This is useful for creating a placeholder commit that you can then amend changes into later using but mark, but rub or but absorb.

You can modify the empty commit message at any time using but reword.

This allows for a more Jujutsu style workflow where you create commits first and then fill them in as you work. Create an empty commit, mark it for auto-commit, and then just work on your changes. Write the commit message whenever you prefer.

Examples

Insert at the top of the first branch (no arguments):

but commit empty

Insert before a commit:

but commit empty ab

Explicitly insert before a commit:

but commit empty --before ab

Insert after a commit (at the top of the stack if target is a branch):

but commit empty --after ab

Usage: but commit empty [TARGET] [OPTIONS]

Arguments:

  • <TARGET> — The target commit or branch to insert relative to.

If a target is provided without --before or --after, defaults to --before behavior. If no arguments are provided at all, inserts at the top of the first branch.

Options:

  • --before <BEFORE> — Insert the blank commit before this commit or branch
  • --after <AFTER> — Insert the blank commit after this commit or branch

Options

  • -m, --message <MESSAGE> — Commit message
  • --message-file <FILE> — Read commit message from file
  • -c, --create — Whether to create a new branch for this commit. If the branch name given matches an existing branch, that branch will be used instead. If no branch name is given, a new branch with a generated name will be created
  • -o, --only — Only commit staged files, not unstaged files
  • -n, --no-hooks — Bypass pre-commit hooks
  • -i, --ai <AI> — Generate commit message using AI with optional user summary. Use --ai by itself or --ai="your instructions" (equals sign required for value)
  • -p, --changes <CHANGES> — Uncommitted file or hunk CLI IDs to include in the commit. Can be specified multiple times or as comma-separated values. If not specified, all uncommitted changes (or changes staged to the target branch) are committed

Last updated on

On this page

Edit on GitHubGive us feedback