I want to copy not changes, but entire files, which are not present, to on one branch, from another.
It this possible with either Git or IntelliJ?
Currently I am opening diff and copy paste files. But this way I can easily misspell file name and/or file location. Can I add some automation here?
Yes, there has an easier way to copy all the files from a branch to another branch by git.
Assume copy all the files from branchA
to branchB
, then you can execute below commands (also can execute in IntelliJ idea termainal window):
git checkout branchB
git checkout branchA -- .
git commit -m 'copy files from branchA to branchB'
UPD. Since IntelliJ 2018.3, there is the Get action available inside the Compare with Working tree dialog.
Old reply: Command-line git can do this, but it is not possible from the Compare branches in IntelliJ. There is a request to add mentioned functionality - please vote for https://youtrack.jetbrains.com/issue/IDEA-95494
As a workaround one could youse the Get action from a file Git history.
There is also a plugin to achieve this https://plugins.jetbrains.com/plugin/10795-git-checkout-files-from-branch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With