Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save manuelmorales/2652291 to your computer and use it in GitHub Desktop.
Save manuelmorales/2652291 to your computer and use it in GitHub Desktop.
How to merge just one file from a another branch with Git
## Lets suppose that we want to merge path/to/my/file.txt from branch_a into branch_b
# We start in branch_b
git checkout branch_b
# We create an intermediate branch
git checkout -b intermediate_branch
# We merge merge_a into that
git merge branch_a
# We go back to branch_b and get the merged file
git checkout branch_b
git checkout intermediate_branch path/to/my/file.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment