Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get just one file from another branch, but which does not exist in the current branch?

I have very a similar question to this question: https://stackoverflow.com/a/2364223/1716560

I have two branches: uk and uk-prod:

git checkout uk-prod
Already on 'uk-prod'

git diff --name-status uk-prod..uk
A       pages/Advanced Types.md
A       pages/Basic Types.md
A       pages/Classes.md

I want to get only file pages/Advanced Types.md:

git checkout uk -- "page/Advanced Types.md"

But git throw:

error: pathspec 'page/Advanced Types.md' did not match any file(s) known to git.

As far as I understand, it happens because git does not see a local file page/Advanced Types.md. Yes or not?

like image 215
ktretyak Avatar asked Feb 13 '16 20:02

ktretyak


People also ask

How do I find a file in a branch?

For listing, you may use git ls-files to list all files recursively in the current index/working directory. You may refer to Git-SCM Docs / git-ls-files or type man git-ls-files if you have installed Git and have man pages available.

How do I pull files from a github branch?

The simple command to PULL from a branch is: git pull 'remote_name' 'branch_name' .


1 Answers

you have a typo - page instead of pages :-)

like image 174
CodeWizard Avatar answered Sep 28 '22 06:09

CodeWizard