From d1707455712995e595721ea9c8936d274cd511f2 Mon Sep 17 00:00:00 2001 From: Phil Date: Sat, 28 Jan 2023 20:53:06 +0000 Subject: [PATCH] Fixed pulldots --- .aliases | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/.aliases b/.aliases index 6fa0dd4..aaa9724 100644 --- a/.aliases +++ b/.aliases @@ -163,18 +163,28 @@ function pullall() { # Pull Dotfiles inside ~/.dotfiles/ function pulldots() { - - # Check if folders are there and if its Master or Main - if [ "$(grep -c -i ""master" "~/.dotfiles/.git/config )" -gt 0 ]; then - CURRENTDIR=$(pwd) && echo "dotfiles Found, Pulling master branch..." && cd ~/.dotfiles/ && git checkout master && git pull && cd $CURRENTDIR && echo "" - - - elif [ "$(grep -c -i ""main" "~/.dotfiles/.git/config )" -gt 0 ]; then - CURRENTDIR=$(pwd) && echo "dotfiles Found, Pulling main branch..." && cd ~/.dotfiles/ && git checkout main && git pull && cd $CURRENTDIR && echo "" - - else - echo "I can't seem to file any dotfiles folders" && echo "" - fi + # Check if folders are there and if its Master or Main + if grep -q -i "master" ~/.dotfiles/.git/config; then + CURRENTDIR=$(pwd) + echo "dotfiles Found, Pulling master branch..." + cd ~/.dotfiles/ + git checkout master + git pull + cd "$CURRENTDIR" + echo "" + + elif grep -q -i "main" ~/.dotfiles/.git/config; then + CURRENTDIR=$(pwd) + echo "dotfiles Found, Pulling main branch..." + cd ~/.dotfiles/ + git checkout main + git pull + cd "$CURRENTDIR" + echo "" + + else + echo "I can't seem to file any dotfiles folders" && echo "" + fi } ## TEST FIX