Loading...
Loading...
error: failed to push some refs to 'origin'. hint: Updates were rejected because the remote contains work that you do not have locally.Your push was rejected because the remote branch has commits that you don't have locally. Git won't let you push because it would overwrite those remote commits.
Fetch the remote changes and merge them with yours.
# Pull remote changes (merge strategy)
git pull origin main
# Resolve any merge conflicts, then
git push origin mainRebase your local commits on top of the remote commits.
git pull --rebase origin main
# If there are conflicts, resolve them then:
git rebase --continue
# Then push
git push origin mainOnly use this if you intentionally want to overwrite the remote. Never on shared branches.
# ⚠️ Destructive — overwrites remote history
git push --force-with-lease origin my-feature-branch