user3619165
user3619165

Reputation: 408

checkout a file from a different branch into a different path in your current branch

So I know we can checkout files from other branches into our current working branch with :

git checkout [someOtherBranch] [path/to/file]

What I'm hoping is that something like this is possible :

git checkout [someOtherBranch] [path/to/file] [path/we/want/to/copy/to]

Is this possible?

Upvotes: 2

Views: 446

Answers (1)

Andrew C
Andrew C

Reputation: 14843

You can cat the contents of the file and then use standard shell redirection to put it wherever you want.

git show [someOtherBranch]:path/to/file > newpath/to/file

Upvotes: 5

Related Questions