Sign In

git mv -n <path> <path>

Shows which files would be renamed or moved without actually changing them.

This command is useful when you want to preview a rename or move operation before committing to it, helping you avoid accidental file changes or conflicts. It performs all the usual checks of a move/rename but stops before modifying anything on disk or in the index.

The first <path> is the current location or name of the file or directory, and the second <path> is the new location or name you plan to use. The -n flag (same as --dry-run) tells Git to simulate the move and print what would happen instead of performing the operation.

Related: Use git mv <path> <path> (without -n) to actually move/rename files, or git status afterward to review staged renames and moves.

Examples:

  • git mv -n src/components/Button.js src/ui/Button.js
  • git mv -n docs/old-guide.md docs/archive/old-guide.md
  • git mv -n assets/logo.png assets/images/logo.png
Manual page
git mv
Related commands

Sign in to Git Examples