I use Git for a project of mine. In one of the directory there are some files. Now I need to rename the directory. After I renamed the directory, git status shows all my files as deleted. So it means I have to add those files again as new file in Git. But I don't want to add all those files as new in Git again.
Is there any way, to rename the directory instead of adding the whole directory and files as new in Git?
git mv --dry-run oldDir newDir
Look good?
git mv oldDir newDir
First you can simply try to git add your old now-deleted folder as well as the new one. Then run git status and you’ll see how git interpreted your changes. It will most likely show your changes as moves, not as deletions & additions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With