🔎 What you'll see
! [rejected] main -> main (fetch first)
🤔 Why it happens
The remote repository (GitHub) has new commits that your computer doesn't, and pushing anyway would wipe them out, so Git refuses. It often happens after you edit a file directly on the GitHub website.
🛠️ How to fix it
- Run git pull first to download and merge the remote changes.
- If the same lines were changed on both sides, you'll get a conflict. Pick what to keep in the marked sections, then commit again.
- git push --force erases the remote changes — don't use it until you know exactly what it does.
🤖 What to ask your AI
Replace the parts in [ ] with your own details, then paste it in.
git push is rejected with 'rejected (fetch first)'. Give me the commands, in order, to safely merge the remote changes without losing them and then push. I'm new to Git.
Other errors
CORS errorThe browser blocks your page from fetching data from another site404 Not FoundThe address or file can't be foundundefined / Cannot read properties of undefinedReading a property of a value that isn't thereis not definedUsing a name that was never declaredSyntaxErrorBrackets or quotes don't match upExposed API keyYou put a secret key in your code or on GitHubMixed ContentAn https page loads something from an http addressBlank white pageYou deployed it and all you see is a blank screenis not a functionCalling something that isn't a functionUnexpected token < in JSONYou expected JSON but got HTMLCannot use import statement outside a moduleThe browser won't accept your import statementfavicon.ico 404The console shows a 404 for favicon.icoData disappears when I refreshYour to-dos or scores aren't being savedPage looks broken or tiny on phonesFine on a computer, weird on mobilenpm: command not foundYour terminal says npm or node doesn't existPort 3000 is already in useYour dev server says the port is takenEnvironment variables (.env) aren't loadingYou put your API key in .env but it comes out undefinedThe AI keeps failing to fix the same errorYou ask for a fix and nothing changes