How to Git cherry-pick only changes to certain files

SupaDupaGuides
Jun 26, 2020

--

Quick-fire instructions to cherry-pick only certain files from a commit.

Git cherry-pick single file / files example.

Get the commit

git cherry-pick -n <commit>

Unstage everything

git reset HEAD

Stage the modifications you want to keep

git add <path>

Make the work tree match the index

# (do this from the top level of the repo)
git checkout .

Done!

--

--

SupaDupaGuides
SupaDupaGuides

Responses (2)