Git pull single file- Is it possible to pull just one file in Git?
I am working on a Git branch that has some broken tests, and I would like to pull (merge changes, not just overwrite) these tests from another branch where they are already fixed.
I know I can do
git pull origin that_other_branch
but this will attempt to merge lots of other files, for that I am not yet ready.
Is it possible to pull and merge only the specified file (and not everything) from that another branch?
You can simply perform fetch which will download all the changes done from your remote repository to your local repository and then check out to that git pull one file in the following way:
git fetch
git checkout -m
git add
git commit
Regarding the git checkout command: - a branch name, i.e. origin/master does not include the repository name (that you can get from clicking copy path button on a file page on GitHub), i.e. README.md