Skip to content

Commit

Permalink
Create worktree.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
FraserYu authored Dec 1, 2021
1 parent fd25c1b commit 4f907ea
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions worktree.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -e

repo=$1
dir="${repo##*/}"
dir="${dir%.*}"
echo $dir
branch=$2
defaultBranch="${branch:-main}"

mkdir -p $dir
cd $dir

git clone --bare $repo .bare
echo "gitdir: ./.bare" > .git
echo " fetch = +refs/heads/*:refs/remotes/origin/*" >> ./.bare/config

git worktree add $defaultBranch

0 comments on commit 4f907ea

Please sign in to comment.