Cherry-picking file from any commit

You’re working on a feature branch and some of the changes you need now are in the pull request your colleague created. You don’t want to cherry-pick the whole commit-config/environment.js file is what you need. Instead of cherry-picking the commit, rejecting changes you don’t need, and leaving config/environment.js intact:

git cherry-pick f0f0f0f0 -n


You can use a more fine-tuned solution:

git checkout f0f0f0f0 config/environment.js


Simple, huh?

This protip has been written in 485 seconds