Git refused your push because GitHub has commits you don't have yet. Nothing is broken and nothing is lost. Get their work first, then push again.
The error
You run git push and see something like this:
! [ rejected ] main - > main ( fetch first ) error: failed to push some refs to 'github.com:you/shop-app.git' hint: Updates were rejected because the remote contains work that you do not hint: have locally. This is usually caused by another repository pushing to hint: the same ref.
Enter fullscreen mode
Exit fullscreen mode
If you already fetched their commits but have not merged them, Git says (non-fast-forward) and “the tip of your current branch is behind its remote counterpart” instead. The cause and the fix are the same.
What it means
Someone pushed to the same branch after you last pulled. It might be a teammate, or you on another computer, or an edit you made in the GitHub website. GitHub will not let your push replace commits you have never seen, because that would delete their work.…