如何将文件从一个git分支复制到另一个git分支并保存为不同的文件?

Dav*_*Xia 3 git

我想将文件从一个git分支复制到另一个git分支,但将其另存为不同的文件名.我知道我可以用同样的名字复制它.在结账时有没有办法重命名?

git checkout otherbranch myfile.txt
Run Code Online (Sandbox Code Playgroud)

the*_*olm 5

git show otherbranch:myfile.txt > myfile2.txt
Run Code Online (Sandbox Code Playgroud)