Skip to content

git commit rejects multiple -m flags #202

@axelbellec

Description

@axelbellec

Problem

rtk git commit rejects multiple -m flags, which is valid native git syntax for multi-paragraph commit messages:

git commit -m "title" -m "body paragraph"

RTK error:

error: the argument '--message <MESSAGE>' cannot be used multiple times

Usage: rtk git commit [OPTIONS] --message <MESSAGE>

Root Cause

In src/main.rs:574-575, the Clap definition for Commit declares message as a single String:

Commit {
    #[arg(short, long)]
    message: String,
},

Clap treats this as a single-value argument, rejecting repeated -m flags.

Fix

Change message to Vec<String> to accept multiple -m values, then pass each one individually to git commit:

// main.rs
Commit {
    #[arg(short, long)]
    message: Vec<String>,
},

// git.rs - run_commit
for msg in &messages {
    cmd.args(["-m", msg]);
}

This matches native git behavior where multiple -m values are concatenated as separate paragraphs.

Reproduction

rtk git commit -m "title" -m "body"
# error: the argument '--message <MESSAGE>' cannot be used multiple times

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions