Copy Files Over Branches

Published on June 16, 2023 | Tags: git TIL

If you have two git branches, you can check out files from one branch from the other like so:

git checkout <the-name-of-the-other-branch> -- path/to/file

And this will, effectively, copy the version of the file from the other branch to your current branch.

Ferran Jovell