diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2023-04-29 11:53:40 +0200 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2023-04-29 11:53:40 +0200 |
| commit | 5ca979eab4f7f4c16adf03927f5bd45000a563c0 (patch) | |
| tree | 0b6baeea4f52e9e467e9d31d2c747f53e59149fb /shell-scripts | |
| parent | 73896a1c800e0623567c63c35b587a61681840ed (diff) | |
fixup
Diffstat (limited to 'shell-scripts')
| -rw-r--r-- | shell-scripts/gh-switch-project | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/shell-scripts/gh-switch-project b/shell-scripts/gh-switch-project index b7054ca..9f460d9 100644 --- a/shell-scripts/gh-switch-project +++ b/shell-scripts/gh-switch-project @@ -1,15 +1,21 @@ #!@bash@/bin/bash eval "$(pass show personal/shell-scripts/secrets)" -repo=$(gh repo list --json owner,name -q '.[] | "\(.owner.login)/\(.name)"' | fzf) +repo=$(gh repo list --json owner,name -q '.[] | "\(.owner.login)/\(.name)"' | fzf --print-query -1) GIT_DIR="$HOME/projects" if [ ! -d $GIT_DIR ]; then mkdir -p $GIT_DIR fi +if [[ "$(echo "$repo" | wc -l)" -ne 1 ]]; then + echo "Fetching my repo" + repo="$(echo "$repo" | tail -n1)" +fi + DEST_DIR="$GIT_DIR/$(echo $repo | cut -d '/' -f2)" -if [ ! -d $DEST_DIR ] +if [ ! -d $DEST_DIR ] then - gh repo clone $repo $DEST_DIR + gh repo clone $repo $DEST_DIR -- --bare fi cd $DEST_DIR +git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" $EDITOR |
