I made 10 commits and each commit has already been moved to the central repository. Suppose I committed a commit, for example.
C1-C2-C3-C4-C5
where C5 was my last latch, and all the latches were pressed. I’m a branch master. I want to delete the history and want to keep the last commit in git logs. I don't want anyone to be able to reset reset to any previous commit or push.
someone told me to use git rebase -i head~4, but I want to be clear before introducing it.
I have the following commands
git checkout --orphan newB
git add -A
git commit
git branch -D master
git branch -m master
git push
and after these commands above my git graph becomes according to the given image below

The current graph of my repository is as follows

. .
git rebase
$ git rebase -i head~5
fatal: Needed a single revision
invalid upstream head~5