- Check in all changes locally
- Branch it (not only for backup, but also to keep commit history when resetting) git branch backup
- Reset to the oldest unpublished commit git reset --hard {sha of commit to push}
- Push it to remote git push origin {branch}
- Go to step 2 if you have more commit to push
- Reset to latest local commit git reset --hard {sha of latest commit}
- Delete backup branch git branch -d backup
Happy coding!