Let’s say there is the project repository (on GitHub) and my fork (also on GitHub). My fork is identical except contains one revision to a single file (a bug fix) which hasn’t (yet) been accepted by the project repository. I’m trying to provide installation instructions to a third party about how to download the latest version of the software, including my bug fix.
As far as I know, they’ll have to do this:
git clone http://projectrepo
git remote add myrepo http://myrepo
git fetch myrepo
git cherry-pick a12345
git remote rm myrepo
(Assume I do not intend to maintain myrepo up to date – I would like my instructions to outlive my involvement with the project, which could end soon. Also assume that other changes could take place to this file, so simply downloading a copy of the whole file is not safe.)
A few suboptimalities with this:
- They need to transfer two whole Git repos
- It’s three extra commands just to get one file.
Are there better solutions? Can you obtain a single revision a simpler way?
Skip the
remote add/remote rm:If you know the commit is the HEAD of
remote-branch-name, then you can dogit cherry-pick FETCH_HEADinstead.