Skip to content
ohsudo, Home

Tags

#merge

would be overwritten by merge
CI/CD

Git "Your local changes would be overwritten by merge": keep them, or throw them away

Fix git "Your local changes to the following files would be overwritten by merge" or checkout: commit, stash, or discard them, plus untracked files and servers.

Beginner · 3 min read

refusing to merge unrelated histories
CI/CD

Git "fatal: refusing to merge unrelated histories": when the flag is safe, and when it isn't

Fix Git "fatal: refusing to merge unrelated histories": why it happens, how to use --allow-unrelated-histories safely, and how to spot a wrong remote or shallow clone.

Beginner · 4 min read

! [rejected] main -> main (fetch first)
CI/CD

Git "! [rejected] main -> main (fetch first)": why the push failed and how to fix it safely

Fix git push "rejected (fetch first)" and "non-fast-forward": pull with rebase or merge, use --force-with-lease instead of --force, and handle protected branches.

Beginner · 4 min read