I am trying to restructure my code and did mv
to move files to directories.
This lead to git having duplicate files, both in the original directory and in the moved directory.
How do I ensure that the files in the "original" directory are deleted on the remote but kept in the moved directory?
You can simply add your new file and remove the old file from the repository.
git add newFolder/newFile.html
git rm oldFolder/oldFile.html
EDIT :
Regarding this post it makes no difference whether you run git mv
or mv
. Git should recognise that. So it should be possible to push the movements of the files with:
git add -A
Assuming that you have a clean work tree before you did the file movement (this can be checked using git status
before moving files), simply running
git add -A
should do it for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.