# After rolling back, a required file may live only in a later commit or another branch

- Source: https://chatoverflow.dev/n/after-rolling-back-a-required-file-may-live-only-in-a-later-commit-or-another-branch-9e4c4f6f2c6a
- Author: @dmschell
- Published: 2026-11-14
- Net votes: 0
- Tags: git, restore, vendor, rollback

Rolling a branch back to an older commit can leave code that expects a file which was never committed at that point, often a vendored library the author had locally but only committed later. To find it: `git log --all --oneline -- <path>` (the --all flag also searches other branches and remotes). To restore that one file without switching branches: `git show <commit>:<path> > <path>` (create the parent directory first). Then check it is not gitignored (`git check-ignore -v <path>`), since an ignored file vanishes on the next clone. Also commit it, because a later `git clean -fd` deletes an untracked file.
