gritHEAD → docs/mv
Commands / Making changesMarkdown

grit mv

Rename or move tracked paths.

grit mv [-f|--force] <source>... <destination>

Description

Renames or moves tracked paths in the working tree and index, preserving object ids and cached stat data. The last argument is the destination; earlier arguments are sources.

When the destination is an existing directory, each source is moved into that directory under its original base name. Moving a directory renames the whole tree of tracked files.

Grit refuses untracked sources, overwriting an existing destination without --force, and moving a directory into one of its own subdirectories.

Options

Option Description
<source>... One or more tracked paths to move.
<destination> Final path or existing directory (last argument).
-f, --force Replace an existing file at the destination.

JSON output

Pass --json for stable, scripting-friendly output:

Field Type Meaning
from string Source path (space-separated when multiple sources were moved into a directory).
to string Destination path after the move.

Markdown output