How do I copy all files in a directory from another branch? I can list all of the files in that directory by doing
git ls-tree master:dirname
If there are no spaces in paths, and you are interested, like I was, in files of specific extension only, you can use
git checkout otherBranch -- $(git ls-tree --name-only -r otherBranch | egrep '*.java')