I notice git has a command named cherry-pick. But this command does not exactly solve what I want to do. The cherry-pick command simply check out a commit, not for specific files.
git-cherry-pick - Apply the changes introduced by some existing commits
Turn out, the git checkout command already has the ability to pick a specific file or directory already.
You can do this with these commands:
$ git checkout feature-branch -- src/js/some-file.js $ git checkout feature-branch -- src/js/some_dir/
Pretty simple, right?