How to push only the latest commit to GitHub without previous history?

hey, i’ve been there! instead of messing with rebase, try this:

git checkout --orphan new_branch
git add -A
git commit -m 'clean start'
git branch -D master
git branch -m master

now u got a fresh master with just 1 commit. push that to github and ur good!