- Switch to a new empty branch.
git switch --orphan <branch-name>
- Remove all the files, mostly all in the
.gitignore
file will start to show here.
rm -rf *
💡 The
rm -rf *
command will delete all the files in your current working directory. If unsure, delete the files manually.
- Add your changes to your new empty branch.
- Lastly, push your changes
git push -u origin <branch-name>
Add better context. rm -rf * is a dangerous command, atleast add disclosures and warnings.