scribble

jonwho?

Blog About Projects Resume GitHub LinkedIn

10 May 2017
Cherry pick individual files

Happened upon this old stackoverflow post when I needed changes only of a specific files and directories instead of a whole commit from another one of my branches. In short you can run:

git show <YOUR_COMMIT_SHA> -- file1 file2 dir1/ | git apply -

which will bring in those files and directory changes to your current branch without commit. You can then use those changes as you please and then commit.

This was a real time saver for me when I would probably just copypasta by hand.


beep boop buhbye,
Jon Ho at 15:49

scribble

Blog About Projects Resume GitHub LinkedIn