git-mini-clone.sh 248 B

12345678910111213
  1. #!/bin/bash
  2. set -xe
  3. REPO="$1"
  4. REF="$2"
  5. DEST="$3"
  6. git init "$DEST"
  7. git -C "$DEST" remote add origin "$REPO"
  8. retry-tool git -C "$DEST" fetch --depth=1 origin "$REF"
  9. git -C "$DEST" config advice.detachedHead false
  10. git -C "$DEST" checkout FETCH_HEAD