modified: nfig1.py
[GalaxyCodeBases.git] / etc / Linux / git-clone-bare-for-worktrees
blob4af67c074acc2650680689b0f3e007e6aae258f8
1 #!/usr/bin/env bash
2 # https://stackoverflow.com/a/62524752/159695
4 set -e
6 url=$1
7 name=${url##*/}
9 git init --bare "${name}"
10 cd "${name}"
11 git config remote.origin.url "$url"
12 git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
13 git fetch
15 firstCommit=$(git rev-list --all --max-parents=0 --date-order --reverse | head -n1)
16 git branch bare-dummy $firstCommit
17 git symbolic-ref HEAD refs/heads/bare-dummy