Homebrew: how to use the formula from the pull request Homebrew: how to use the formula from the pull request git git

Homebrew: how to use the formula from the pull request


You can install a Homebrew formula directly from a pull request by using brew install $raw_pull_requst_url, eg:

brew install https://raw.github.com/ColinHebert/homebrew/538a99cc06a8f40b6ebcf2f4f8fd44d563c672cd/Library/Formula/emacs.rb

For finding the pull request URL, there's probably a better way, but I went to the pull request URL you linked, clicked on Files Changed, then on View File @ 9b22d42, then finally on Raw


The documentation on Github describes that quite verbose (section Merging a Pull Request):

on your repo:

git checkout mastergit remote add colin https://github.com/ColinHebert/homebrew.gitgit fetch colin

Now, you have the full content of the colin repo (including knowledge of the commit hashes used in that repo). Next is to apply the changes. The docs say that you should do a git merge, but that's not so good in our case since colin added the changes to his master. If he works on master (and does some more commits), you'll get these changes too.

Fortunately, the four commits making up the patch are named in the Pull-request: ae28b29e, df10b69a, e8915488, 87f2d1e5. You can apply them with git cherry-pick:

git cherry-pick ae28b29egit cherry-pick df10b69agit cherry-pick e8915488git cherry-pick 87f2d1e5

That's it. You could now delete the remote colin with

git remote rm colin

Another possibility would be to download the patch and apply it:

git checkout mastercurl https://github.com/mxcl/homebrew/pull/6518.patch | git am

The patches for pull requests are always available via

https://github.com/<user>/<repo>/pull/<request_number>.patch


I found the following to be better for the casual homebrew user.

If you are searching for a fix there will be a pull number:

| => brew search vmdktoolNo formula found for "vmdktool".==> Searching pull requests...Open pull requests:vmdktool 1.4 (new formula) (https://github.com/Homebrew/homebrew-core/pull/9109)

Just do brew pull #### where #### is the pull number:

| => brew pull 9109fatal: ref HEAD is not a symbolic refWarning: Current branch is : do you need to pull inside master?==> Fetching patchPatch: https://github.com/Homebrew/homebrew-core/pull/9109.patch==> Applying patchApplying: vmdktool 1.4 (new formula)==> Patch closes issue #9109==> Patch changed: Formula/vmdktool.rb | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)

then do your install/upgrade:

| => brew install vmdktoolUpdating Homebrew...==> Auto-updated Homebrew!Updated Homebrew from 11cf7b9 to 1f97e31.No changes to formulae.==> Using the sandbox==> Downloading https://people.freebsd.org/~brian/vmdktool/vmdktool-1.4.tar.gz######################################################################## 100.0%==> make CFLAGS='-D_GNU_SOURCE -g -O -pipe'==> make install PREFIX=/usr/local/Cellar/vmdktool/1.4🍺  /usr/local/Cellar/vmdktool/1.4: 4 files, 34.4K, built in 2 seconds