Instead of trying to manually parse the output of 'git show' which can be different across different git configurations, properly use the 'git rev-parse' command that is intended for this purpose.
[ -d minetest ] && (cd minetest && git pull) || (git clone https://github.com/minetest/minetest)
fi
cd minetest
-git_hash=`git show | head -c14 | tail -c7`
+git_hash=$(git rev-parse --short HEAD)
# Get minetest_game
cd games
[ -d minetest ] && (cd minetest && git pull) || (git clone https://github.com/minetest/minetest)
fi
cd minetest
-git_hash=`git show | head -c14 | tail -c7`
+git_hash=$(git rev-parse --short HEAD)
# Get minetest_game
cd games