GIT-MV(1)
π GIT-MV(1) β the git manual, but make it cute π
okay so real talk: this is git-mv, straight out of the Git Manual. she moves stuff. she renames stuff. she's lowkey the friend who helps you pack. let's get into it bestie β¨
πΈ NAME πΈ
git-mv β move or rename a file, a directory, or a symlink
π¦ SYNOPSIS π¦
git mv [-v] [-f] [-n] [-k] <source> <destination>
git mv [-v] [-f] [-n] [-k] <source>... <destination-directory>
β¨ DESCRIPTION β¨
Move or rename a file, directory, or symlink. that's it. that's the whole vibe π
So there's two forms, right, and they're giving very different energy:
- Form one β you take source and rename it to destination. but bestie, source must exist, and it has to be a file, a symlink, or a directory. no imaginary friends. no cap.
- Form two β destination-directory has to be a directory that actually already exists, and all the sources you listed get moved into it. like, they all go live in that house together π
The index gets updated after it completes successfully, but β and this is the important part, don't @ me β the change must still be committed. so don't just walk away thinking you're done π
π OPTIONS π
-f,--forceβ force the renaming or moving of a file even if the destination already exists. she will simply bulldoze right on through π₯-kβ skip move or rename actions that would lead to an error condition. an error happens when a source is neither existing nor controlled by Git, or when it would overwrite an existing file unless-fis given. so like, she just quietly skips the drama π§-n,--dry-runβ do nothing; only show what would happen. purely a vibe check, zero commitment π-v,--verboseβ report the names of files as they are moved. she'll narrate her every move, main character energy π
π SUBMODULES π
Moving a submodule that uses a gitfile (which means they were cloned with a Git version 1.7.8 or newer) will update the gitfile and core.worktree setting so the submodule actually works in its new location. iconic, honestly.
It also will attempt to update the submodule.<name>.path setting in the gitmodules(5) file and stage that file β unless -n is used, in which case, no staging, we're just looking β¨
π BUGS π
okay so here's the messy part. each time a superproject update moves a populated submodule (like, for example, when switching between commits before and after the move), a stale submodule checkout will remain in the old location and an empty directory will appear in the new location. it's giving "left my stuff at my ex's place" π
To populate the submodule again in the new location, the user will have to run git submodule update afterwards. that's the fix, run it.
And listen β removing the old directory is only safe when it uses a gitfile, because otherwise the history of the submodule will be deleted too. so please, bestie, check before you rm -rf, that's how people lose their whole lives π
Both of those steps will be obsolete when recursive submodule update has been implemented. future us is gonna be so chill about this.
π«Ά GIT π«Ά
Part of the git(1) suite. one big happy family π
okay that's the whole page, mwah π this edition came from Git 2.56.0, dated 2026-09-27 β so if you're reading this from the future, hi, hope your submodules are fine π¦β
π¦ where this page comes from
- arch rolling: git 2.56.0-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms