gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 02:38:36 25 4
gpt4 key购买 nike

我正在尝试从 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.

我也试过this的建议没有任何运气的旧 SO 主题。

最佳答案

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

The supported method of installing specific versions of some formulae is to see if there is a versioned formula (e.g. gcc@7) available. If the version you’re looking for isn’t available, consider using brew extract.

运行这些命令创建一个名为 $USER/local-tap 的 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

关于git - 使用 brew 在 MacOS 上安装特定的 git 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69500383/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com