Why was my push rejected with "non-fast-forward" or "fetch first"?
IntermediateConceptConflicts, remotes, fetch, pull and push
Answer
The remote branch has commits you do not have, so updating it would discard them. Fetch, then integrate with merge or rebase and push again. Force-pushing is only right for your own feature branch, and then only with lease.
! [rejected] main -> main (fetch first)
hint: Updates were rejected because the remote contains work that you do not have locally.
More on Conflicts, remotes, fetch, pull and push
What do conflict markers look like and how do you resolve them?BeginnerWhat is `merge.conflictStyle=zdiff3` and why use it?IntermediateHow do you quickly take one side's version for a conflicted file?IntermediateWhat are stages 1, 2 and 3 in the index during a conflict?AdvancedHow do you see what a merge conflict is about before resolving?IntermediateWhat is the difference between `git fetch` and `git pull`?Beginner