Copy File Between Git Branches

Arunvel SriramArunvel Sriram
1 min read

TIL that we can copy single file from another branch to current branch:

git checkout <branch-containing-the-file> </path/to/file>

In below screenshot we are copying a file from fiber-server-options to main branch:

Screenshot demonstrating copying file between git branches

1
Subscribe to my newsletter

Read articles from Arunvel Sriram directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Arunvel Sriram
Arunvel Sriram

Software Engineer | Polyglot | DevOps | Open Source