diff --git a/Library/Homebrew/cmd/edit.rb b/Library/Homebrew/cmd/edit.rb index 06be636dc6..3fd3bfe093 100644 --- a/Library/Homebrew/cmd/edit.rb +++ b/Library/Homebrew/cmd/edit.rb @@ -2,6 +2,14 @@ require 'formula' module Homebrew extend self def edit + unless (HOMEBREW_PREFIX/'.git').directory? + raise <<-EOS.undent + Changes will be lost! + The first time you `brew update', all local changes will be lost, you should + thus `brew update' before you `brew edit'! + EOS + end + # If no brews are listed, open the project root in an editor. if ARGV.named.empty? editor = File.basename which_editor