🌿 Git & Version Control Issues
Merge conflicts, lost commits in rebase, force-push regrets, detached HEAD, LFS, submodules, big files, CRLF.
Git errors are rarely "obvious mistakes" — they are "I don`t understand my own state": commits vanished, a teammate`s work got overwritten by force-push, the submodule will not pull, a big file blocks push, CRLF blows up a 3,000-line diff out of nowhere. This hub is organized by real incident type — one article per symptom (not "git tutorial") — with executable steps like "check git reflog first / use git fsck for dangling objects / use git filter-repo to strip big files". Complements [[ai-coding-issues]] / [[git-find-old-version]]: that side handles "AI broke my code, how do I recover"; this side handles "any source of git pain, how do I fix it".
Common problems
- Binary file merge conflict — can`t resolve manually Use git checkout --theirs/--ours; text 3-way merge does not apply.
- Commits disappeared after a rebase Check git reflog first; cherry-pick lost shas back.
- Force push overwrote teammates` commits Find old sha via GitHub events API; restore via reflog + cherry-pick.
- I committed in detached HEAD — now what? git branch tempfix HEAD to save the commit, then switch back.
- Large file in history blocks the push Strip with git filter-repo; avoid stale BFG / filter-branch.
- Submodule won`t update to the latest commit git submodule update --remote --merge; check the .gitmodules branch.
- Cherry-pick becomes empty after resolving conflicts git cherry-pick --allow-empty / --skip; confirm target already has the change.
- Stash gone after checkout git fsck --unreachable to find dangling stash; git stash apply <sha>.
- Branch protection blocks a legitimate merge Required-check name changed; sync protection rules.
- Tag points to the wrong commit git tag -f -a v1.2.3 <sha> + git push --force origin v1.2.3.
- Monorepo partial clone has stale objects git fetch --refetch; or git sparse-checkout reapply.
- Git LFS pointer not resolved into the real file git lfs install + git lfs pull; verify .gitattributes.
- git pull --rebase scrambled my conflict history Enable rerere; prefer merge commit for conflict-heavy merges.
- Credential helper locked, all pulls / pushes fail Delete ~/.git-credentials lock; clear Keychain entry on macOS.
- Git hooks don`t run after clone Hooks aren`t cloned; use husky or git config core.hooksPath.
- Reverting a merge commit complains about missing -m parent git revert -m 1 <merge-sha>; pick the mainline parent.
- Bisect stuck on skipped commits git bisect skip current; if all skipped, visualize and reroute.
- I pushed a secret to a public repo Rotate immediately; git filter-repo to scrub history; contact GitHub support.
- Worktree turns ghost after branch deletion git worktree prune; --force to clean dangling dirs.
- CRLF conversion blew up into a 3000-line diff Explicit LF in .gitattributes; --renormalize one-shot fix.