小编Kyl*_*e C的帖子

文件分阶段内容与HEAD不同

当我尝试使用时,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.

git

7
推荐指数
2
解决办法
6685
查看次数

访问Rescue Block中的错误消息

有没有办法在救援块中以字符串形式访问错误消息?例如:

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)

ruby

1
推荐指数
1
解决办法
732
查看次数

标签 统计

git ×1

ruby ×1