| glab(1) | glab(1) |
NAME
glab-mr-note-draft-create - Add a pending review comment to a merge request. (EXPERIMENTAL)
SYNOPSIS
glab mr note draft create [ | ] [flags]
DESCRIPTION
Add a comment to your pending review. The comment stays visible only to you until you publish the review with glab mr note draft publish or submit it from the merge request page.
On success, the command prints the ID of the pending comment. Pass that ID to glab mr note draft update or glab mr note draft delete.
Use --file to place the comment on a specific file in the latest merge request diff version. Combine with --line (new side) or --old-line (old/removed side) to target a specific line. Omit both flags for a file-level comment.
Use --reply to reply to an existing discussion thread. The value can be a full discussion ID or a unique prefix of at least 8 characters. Find discussion IDs with glab mr note list.
The flag rules are:
- --line and --old-line require --file, and cannot be used together.
- --file and --reply are mutually exclusive.
--attach uploads a file and references it at the end of the comment. Repeat the flag for more than one file, or pass - to read the file from standard input. The upload happens immediately, even though the comment stays pending. An attachment is content on its own, so a comment with only --attach neither prompts nor reads a body from stdin.
This feature is an experiment and is not ready for production use. It might be unstable or removed at any time. For more information, see https://docs.gitlab.com/policy/development_stages_support/.
OPTIONS
--attach=[] (EXPERIMENTAL) Upload a file and reference it at the end of the comment. Use "-" to read the file from standard input. Repeat the flag to attach multiple files.
--file="" File path for a diff comment, like . Targets the latest merge request diff version.
--line="" Line in the new version. A single line number, like 42, or a range, like 10:15.
-m, --message="" Comment message. If omitted, opens an editor or reads from stdin.
--old-line=0 Line in the old version, for commenting on a removed line.
--reply="" Reply to an existing discussion. Accepts a full discussion ID or a unique prefix of at least 8 characters.
OPTIONS INHERITED FROM PARENT COMMANDS
-h, --help[=false] Show help for this command.
-R, --repo="" Select another repository. You can use either OWNER/REPO or GROUP/NAMESPACE/REPO. The full URL or Git URL is also accepted.
EXAMPLE
# Add a pending comment to merge request 123 glab mr note draft create 123 -m "Consider renaming this." # Add a pending comment to the current branch's merge request glab mr note draft create -m "Looks good overall." # Pipe the body from stdin echo "Needs a test." | glab mr note draft create 123 # Add a pending diff comment on line 42 of main.go glab mr note draft create 123 --file main.go --line 42 -m "Off-by-one?" # Add a pending diff comment on lines 10-15 glab mr note draft create 123 --file main.go --line 10:15 -m "Extract this block." # Add a pending diff comment on a removed line glab mr note draft create 123 --file main.go --old-line 7 -m "Why was this removed?" # Add a pending reply to an existing discussion thread glab mr note draft create 123 --reply abc12345 -m "Agreed." # Keep the ID of the pending comment for a later update id=$(glab mr note draft create 123 -m "First pass")
SEE ALSO
| Oct 2026 | Auto generated by spf13/cobra |