diff --git a/scripts/generate-git-snapshot b/scripts/generate-git-snapshot index 0486222..6d6a125 100755 --- a/scripts/generate-git-snapshot +++ b/scripts/generate-git-snapshot @@ -487,7 +487,11 @@ fi # revert to original debian/changelog to avoid merge conflicts git checkout -- $(readlink -f debian/changelog) -git checkout -f ${GIT_BRANCH} # switch back to previous "branch" before removing the tmp branch +# switch back to previous "branch" before removing the tmp branch +if ! git checkout -f "${GIT_BRANCH}"; then + # we were probably detached + git checkout -f "${GIT_COMMIT}" +fi git branch -D "$random_branch" # vim:foldmethod=marker ts=2 ft=sh ai expandtab sw=2