Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check out a file from another branch into a new file in the current branch with git?

Tags:

git

Let's say that I have a file core.clj in branch master at HEAD which is distinct from core.clj in branch other at HEAD, and that I am currently in branch other. I would like to checkout master's core.clj into the current branch with some other file name, say tmp.clj, for easy comparison.

How can I do this?

like image 358
James Atwood Avatar asked Feb 20 '23 08:02

James Atwood


1 Answers

You can use git show master:core.clj to show the file. Redirect it to a new file (git show ... > temp.clj to save it for further processing.

like image 187
twalberg Avatar answered May 20 '23 08:05

twalberg