tldr/pages/common/git-mv.md

17 lines
417 B
Markdown
Raw Normal View History

2015-12-17 21:22:16 +00:00
# git mv
2021-01-07 14:06:38 +00:00
> Move or rename files and update the Git index.
> More information: <https://git-scm.com/docs/git-mv>.
2015-12-17 21:22:16 +00:00
- Move file inside the repo and add the movement to the next commit:
2015-12-17 21:22:16 +00:00
`git mv {{path/to/file}} {{new/path/to/file}}`
- Rename file and add renaming to the next commit:
2015-12-17 21:22:16 +00:00
`git mv {{filename}} {{new_filename}}`
- Overwrite the file in the target path if it exists:
2015-12-17 21:22:16 +00:00
`git mv --force {{file}} {{target}}`