I have multiple branches of a project checked out, each under their own directory (pretty standard).
src/branch1/some/code/directories src/branch2/some/code/directories
I often find myself wanting to copy selected files from one branch to another. An example would be copying cvsignore files, or intellij module files. The pseudocommand for what I’m trying to do is ‘copy all files under branch1 matching PATTERN to branch2, preserving the relative path of the copied file’.
This question looks close to what I’m looking for, but I need an OS X/linux/unix solution.
Use ‘cp -r –parents’ command like this, in branch1 directory
OR
When in the src/ directory, run this script. You can get the variables from command line parameters if you want.