How to move a tracked file?
git mv file_name existing_directory
To move a file tracked by git use
git mv file_name existing_directory. This command will move the file and add it to your staging area. You will still need to commit the changes with
git mv image.png assets
On branch main
Changes to be committed:
(use "git restore --staged
..." to unstage)
renamed: image.png -> assets/image.png
See git mv to learn more about it.