build-git function