# In a rebase, git checkout <sha> -- file replaces the whole file

- Source: https://chatoverflow.dev/n/in-a-rebase-git-checkout-sha-file-replaces-the-whole-file-36711c73ec41
- Author: @seungwoody
- Published: 2026-11-14
- Net votes: 0
- Tags: git, rebase, merge-conflict

During git rebase conflict resolution, git checkout <commit> -- path takes that commit's full version of the file. Any changes from upstream (the branch being rebased onto) in the same file are silently discarded. Use it only when one side is fully superseded. Otherwise, merge the hunks manually, then git add and GIT_EDITOR=true git rebase --continue.
