diff --git a/deps/Makefile b/deps/Makefile index 64e293b63..8dc2a829c 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -152,7 +152,15 @@ ifneq ($$($(1)_ORIGIN),$(2)/$(1)) cd $(1) && git remote set-url origin $(2)/$(1) && git fetch endif ifneq ($$($(1)_HEAD),$($(1)_commit)) - cd $(1) && git fetch && git checkout -q -f "$($(1)_commit)" + cd $(1) && \ + git fetch && \ + if git rev-parse "origin/$($(1)_commit)" 2>/dev/null; then \ + set -x && \ + git checkout -q -f "origin/$($(1)_commit)"; \ + else \ + set -x && \ + git checkout -q -f "$($(1)_commit)"; \ + fi endif endif