Files
30-seconds-of-code/git/snippets/copy-file-from-branch.md
2023-05-01 22:28:09 +03:00

498 B

title, type, tags, author, cover, dateModified
title type tags author cover dateModified
Copy a file from another branch snippet
branch
chalarangelo sea-view-2 2021-04-13T21:10:59+03:00

Copies a file from another branch to the current branch.

  • Use git checkout <branch> <file> to copy the specified <file> from the specified <branch>.
git checkout <branch> <file>
git checkout patch-2
git checkout patch-1 "30seconds.txt"
# `patch-2` branch now contains the 30seconds.txt file from `patch-1`