当我尝试使用时,git rm --cached我收到以下错误:
error: the following file has staged content different from both the file and the HEAD:
Run Code Online (Sandbox Code Playgroud)
我知道我可以绕过这个错误git rm --cached -f <filename>.但通常当我取消文件时,git rm --cached我不会收到此错误.
我的问题是,该文件具有不同的分阶段内容是什么意思HEAD.
有没有办法在救援块中以字符串形式访问错误消息?例如:
def foo
raise RuntimeError, "This is an error"
end
def bar
begin
foo
rescue RuntimeError
puts "Rescued"
end
end
bar
Run Code Online (Sandbox Code Playgroud)
有没有办法"This is an error"从救援区获得进入?像这样的东西:
...
rescue RuntimeError
puts <error-message>
end
...
Run Code Online (Sandbox Code Playgroud)