macos 重置自制配方

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9369519/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:54:05  来源:igfitidea点击:

Reset Homebrew Formula

macoshomebrew

提问by Tyler DeWitt

While trying to install FreeTDS via Homebrew, I ran brew edit freetds. I edited the file. I'd like to restore the Recipe file (freetds.rb) to it's orinal state in case I introduced a typo into it.

在尝试通过 Homebrew 安装 FreeTDS 时,我运行了brew edit freetds. 我编辑了文件。我想将 Recipe 文件 (freetds.rb) 恢复到它的原始状态,以防我在其中引入了拼写错误。

Is there a way to reset a brew formula file?

有没有办法重置 brew 公式文件?

Thanks

谢谢

采纳答案by duskwuff -inactive-

Homebrew recipes are managed via Git, so you can just git checkout freetds.rbto wipe out your local changes.

Homebrew 食谱是通过 Git 管理的,因此您只需git checkout freetds.rb清除本地更改即可。

回答by ewakened

You need to reset your Cellar git repo.

您需要重置您的 Cellar git repo。

cd `brew --cellar`
git reset --hard HEAD
brew upgrade <formula>

That should do it!

应该这样做!

回答by Adam Lindberg

For Homebrew version 2.1.4 on macOS Mojave the following command will work from anywhere for homebrew-coreformulas:

对于 macOS Mojave 上的 Homebrew 2.1.4 版,以下命令可以在任何地方用于homebrew-core公式:

git -C $(brew --repo)/Library/Taps/homebrew/homebrew-core checkout Formula/$FORMULA_NAME.rb

Where $FORMULA_NAMEis the name of the formula you have edited.

$FORMULA_NAME您编辑的公式的名称在哪里。

回答by robertodaza

You can reset all formulas with: brew update-reset

您可以使用以下方法重置所有公式: brew update-reset