I've got a code work flow dependent on pulling changes from a repo clones on dev machines into a repo master, then updating copies of that repo master on prod machines using something like a "git fetch" followed by a "git merge."
I've run into an issue where I've committed things to master, but due to a code freeze those changes were never pulled into the prod machines. To get out of the code freeze, I need to update a single file that's also been commited to master.
At this point, the prod machines are all behind the master repo by something like 10 commits. It is only the most recent commit that I want to pull into the prod machines. A "git fetch && git merge" is going to fast-forward my whole repo when all I need is a single file fast-forwarded.
What's the best way to cherry-pick that single file? If I "git checkout file.ext" then it updates from the local repo copy and not the updated master. I'd like to get my local copy to "know" about the most recent version of the file without updating everything else.
My idea was to do a "git fetch" to update the repo and then a "git checkout file.ext" to update just one file. Is that the best way of doing what I want to do? If not, can someone please advise me on a way to checkout a single updated file from a master that's behind on many Git commits?
Try something like
git fetch
git checkout master -- src/your/file.txt