...
push the branch
find a previous commit of the commit that added the sensitive data and copy the commit hash
hard-reset
Code Block git reset --hard <commit-hash>
force-push
Code Block git push -f
...
create a local back up branch in case the branch is messed up
switch to the branch of the PR that has the sensitive data
make a commit to delete the sensitive data if you have not and push the branch (this is for the sensitive data not to show on GitHub after force-pushing)push the branch
rewrite commit history using
git rebase -i
(https://docs.github.com/en/get-started/using-git/using-git-rebase-on-the-command-line)force-push
...