{
    "mode": "info",
    "parameter": "git-mv",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/git-mv/json",
    "generated": "2026-07-13T13:35:27Z",
    "synopsis": "git mv <options>... <args>...",
    "sections": {
        "NAME": {
            "content": "git-mv - Move or rename a file, a directory, or a symlink\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "git mv <options>... <args>...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Move or rename a file, directory or symlink.\n\ngit mv [-v] [-f] [-n] [-k] <source> <destination>\ngit mv [-v] [-f] [-n] [-k] <source> ... <destination directory>\n\nIn the first form, it renames <source>, which must exist and be either\na file, symlink or directory, to <destination>. In the second form, the\nlast argument has to be an existing directory; the given sources will\nbe moved into this directory.\n\nThe index is updated after successful completion, but the change must\nstill be committed.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-f, --force",
                    "content": "Force renaming or moving of a file even if the target exists\n",
                    "flag": "-f",
                    "long": "--force"
                },
                {
                    "name": "-k",
                    "content": "Skip move or rename actions which would lead to an error condition.\nAn error happens when a source is neither existing nor controlled\nby Git, or when it would overwrite an existing file unless -f is\ngiven.\n",
                    "flag": "-k"
                },
                {
                    "name": "-n, --dry-run",
                    "content": "Do nothing; only show what would happen\n",
                    "flag": "-n",
                    "long": "--dry-run"
                },
                {
                    "name": "-v, --verbose",
                    "content": "Report the names of files as they are moved.\n",
                    "flag": "-v",
                    "long": "--verbose"
                }
            ]
        },
        "SUBMODULES": {
            "content": "Moving a submodule using a gitfile (which means they were cloned with a\nGit version 1.7.8 or newer) will update the gitfile and core.worktree\nsetting to make the submodule work in the new location. It also will\nattempt to update the submodule.<name>.path setting in the\ngitmodules(5) file and stage that file (unless -n is used).\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Each time a superproject update moves a populated submodule (e.g. when\nswitching between commits before and after the move) a stale submodule\ncheckout will remain in the old location and an empty directory will\nappear in the new location. To populate the submodule again in the new\nlocation the user will have to run \"git submodule update\" afterwards.\nRemoving the old directory is only safe when it uses a gitfile, as\notherwise the history of the submodule will be deleted too. Both steps\nwill be obsolete when recursive submodule update has been implemented.\n",
            "subsections": []
        },
        "GIT": {
            "content": "Part of the git(1) suite\n\nGit 2.34.1                        02/26/2026                         GIT-MV(1)",
            "subsections": []
        }
    },
    "summary": "git-mv - Move or rename a file, a directory, or a symlink",
    "flags": [
        {
            "flag": "-f",
            "long": "--force",
            "arg": null,
            "description": "Force renaming or moving of a file even if the target exists"
        },
        {
            "flag": "-k",
            "long": null,
            "arg": null,
            "description": "Skip move or rename actions which 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 -f is given."
        },
        {
            "flag": "-n",
            "long": "--dry-run",
            "arg": null,
            "description": "Do nothing; only show what would happen"
        },
        {
            "flag": "-v",
            "long": "--verbose",
            "arg": null,
            "description": "Report the names of files as they are moved."
        }
    ],
    "examples": [],
    "see_also": []
}