2015-12-17 21:22:16 +00:00
|
|
|
# git mv
|
|
|
|
|
|
|
|
> Move or rename files and update the git index.
|
2019-01-30 11:19:23 +00:00
|
|
|
> Homepage: <https://git-scm.com/docs/git-mv>.
|
2015-12-17 21:22:16 +00:00
|
|
|
|
2016-01-07 17:31:27 +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}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Rename file and add renaming to the next commit:
|
2015-12-17 21:22:16 +00:00
|
|
|
|
|
|
|
`git mv {{filename}} {{new_filename}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Overwrite the file in the target path if it exists:
|
2015-12-17 21:22:16 +00:00
|
|
|
|
|
|
|
`git mv --force {{file}} {{target}}`
|