git clean all submodules on branch switch 1

git clean all submodules on branch switch

# Be careful it will delete all untracked files, reset all stagated files
# and will remove all submodule folders
git reset --hard
git checkout gh-pages
git clean -xffd
# Optional restoration of submodules content
git submodule update --init --recursive

Here is what the above code is Doing:
1. Checkout the gh-pages branch
2. Remove all files from the gh-pages branch
3. Copy the contents of the public folder to the root of the gh-pages branch
4. Commit the changes
5. Push the gh-pages branch to the remote repository

Similar Posts