Here is a slightly easier method I just came up with when researching this:
git fetch {remote}
git checkout FETCH_HEAD -- {file}
More Related Contents:
- How do I force "git pull" to overwrite local files?
- Merge, update, and pull Git branches without using checkouts
- What does FETCH_HEAD in Git mean?
- Why does git say “Pull is not possible because you have unmerged files”?
- What is the difference between git pull and git fetch + git rebase?
- GIT pull error – remote object is corrupted
- Merge, update, and pull Git branches without using checkouts
- Restore git files deleted after git merge –abort
- The following untracked working tree files would be overwritten by merge, but I don’t care
- How do I resolve merge conflicts in a Git repository?
- Support for password authentication was removed. Please use a personal access token instead
- Having a hard time understanding git-fetch
- Undo git pull, how to bring repos to old state
- How to import existing Git repository into another?
- How can I prevent foxtrot merges in my ‘master’ branch?
- How can I merge two commits into one if I already started rebase?
- How do I ignore an error on ‘git pull’ about my local changes would be overwritten by merge?
- How to resolve git error: “Updates were rejected because the tip of your current branch is behind”
- fetch in git doesn’t get all branches
- git stash and apply
- How do I ‘overwrite’, rather than ‘merge’, a branch on another branch in Git?
- ‘git pull origin mybranch’ leaves local mybranch N commits ahead of origin. Why?
- Merging without whitespace conflicts
- git fetch, FETCH_HEAD and origin/master
- How can I preview a merge in git?
- `git fetch` a remote branch
- Git merge doesn’t use default merge message, opens editor with default message
- How to see commits that were merged in to a merge commit?
- Git: Merge a Commit into a different Branch
- Differences between git remote update and fetch?