O
O
Optimus2017-07-26 14:15:57
git
Optimus, 2017-07-26 14:15:57

How to pull one file in git?

I must be specifying the path to the file incorrectly

git checkout 6g25701874aa5a2c16cc6275fa30baa5b6e477a8 block/prod/work/class/MyFile.php

Error:
fatal: reference is not a tree: 6g25701874aa5a2c16cc6275fa30baa5b6e477a8
Googled, usually such an error occurs when updating. What is the reason? I want to pull from the master, but now I'm in another branch, is it necessary to change the branch before pulling? Or am I incorrectly specifying the path to the file, is it necessary with the name of the project in its entirety or in some other way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2017-07-26
@Lynn

If you just need to checkout a file from the master, then just take the file from the master:
git checkout master -- block/prod/work/class/MyFile.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question