Working with GIT is one of the best things that happened to software development. However, sometimes in very rare instances, you may have the need to copy(checkout) a file from one branch to the other.
Here is a quick tip should you ever need to do that, assuming you want to copy the file "composer.lock" from branch A to B
- Check into branch A and pull in the latest changes
git checkout A && git pull
- Check into branch B
git checkout B
- Checkout the file - make sure to use the correct path
git checkout A composer.lock
- Should you wish to add the file to the current branch, run this:
git add composer.lock
That's it, hope it was useful 🤩🤩🤩
Comments (0)