I want to delete all of the current directory\'s content except for the .git/ folder before I copy the new files into the branch.
One way is to use rm -rf *, which will delete all files from the folder except the dotfiles and dotfolders like .git. You can then delete the dotfiles and dotfolders one by one, so that you don't miss out on important dotfiles like .gitignore, .gitattributes later.
Another approach would be to move your .git folder out of the directory and then going back and deleting all the contents of the folder and moving the .git folder back.
mv .git/ ../
cd ..
rm -rf folder/*
mv .git/ folder/
cd folder