Git Fatal: Refusing to Merge Unrelated Histories – Workaround - npm EACCES Error: Install Without Sudo-Fix Detached HEAD in Git Without Losing Work

Result check
- Keep one change per test run so you know which step helped.
- Undo temporary changes after the issue is confirmed.