xxxxxxxxxx
git pull --rebase
git push
xxxxxxxxxx
//git error: failed to push some refs to remote
git reset --mixed origin/main
git add .
git commit -m "This is a new commit for what I originally planned to be amended"
git push origin main
xxxxxxxxxx
#try this works 100%
git pull origin main
#If the request succeeds, then go on and run the command below to push your own changes
git push -u origin main
#If the error persists, you'll get an error that says: fatal: refusing to merge unrelated histories
git pull --rebase origin main
git push -u origin main
#Success!!
xxxxxxxxxx
git config --global pull.rebase true
git config --global rebase.autoStash true