簡體   English   中英

使用 brew 在 MacOS 上安裝特定的 git 版本

[英]Install specific git version on MacOS using brew

我正在嘗試從brew安裝舊的git版本。

我已經安裝了git 2.33.1

▶ brew info git
git: stable 2.33.0 (bottled), HEAD
Distributed revision control system
https://git-scm.com
/usr/local/Cellar/git/2.33.0_1 (1,508 files, 42MB) *
  Poured from bottle on 2021-10-08 at 12:06:00
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/git.rb
License: GPL-2.0-only
==> Dependencies
Required: gettext ✔, pcre2 ✔
==> Options
--HEAD
    Install HEAD version
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> Analytics
install: 198,758 (30 days), 658,960 (90 days), 2,607,801 (365 days)
install-on-request: 194,065 (30 days), 644,952 (90 days), 2,558,858 (365 days)
build-error: 0 (30 days)

我想要(出於某些故障排除目的)舊版本,即2.25.1

為什么似乎沒有其他(舊)版本可用?

▶ brew install git@2.25.1
Warning: No available formula or cask with the name "git@2.25.1".
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

我也嘗試了這個較舊的 SO 主題的建議, 沒有任何運氣。

https://docs.brew.sh/Tips-N'-Tricks#installing-previous-versions-of-formulae

安裝某些公式的特定版本的支持方法是查看是否有可用的版本化公式(例如gcc@7 )。 如果您要查找的版本不可用,請考慮使用brew extract

運行這些命令來創建一個名為$USER/local-tap ,將git 2.25.1 解壓到你的 tap 中,然后安裝:

brew tap-new --no-git $USER/local-tap
brew extract --version=2.25.1 git $USER/local-tap
brew install git@2.25.1
/usr/local/opt/git@2.25.1/bin/git --version

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM