File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,24 +60,19 @@ if [ -d "$INSTALL_DIR" ]; then
6060 fi
6161 fi
6262
63- git fetch origin
64-
65- # Prompt for confirmation before overwriting
66- echo -e " ${YELLOW} Warning: The directory $INSTALL_DIR already contains a repository.${NC} "
67- echo -e " ${YELLOW} Updating will perform a hard reset and discard all local changes.${NC} "
68- # Read from /dev/tty to handle pipe execution
69- if [ -t 0 ]; then
70- read -p " Do you want to update and reset the repository? (y/N) " confirm
71- else
72- read -p " Do you want to update and reset the repository? (y/N) " confirm < /dev/tty
73- fi
63+ # Prompt for confirmation BEFORE any git operations
64+ echo -e " ${YELLOW} Existing repository detected at $INSTALL_DIR .${NC} "
65+ echo -e " ${YELLOW} Would you like to fetch and reset to latest origin/$BRANCH ? (y/N)${NC} "
66+ read -p " > " confirm < /dev/tty
7467
7568 if [[ " $confirm " == " y" || " $confirm " == " Y" ]]; then
69+ echo -e " ${BLUE} Updating repository...${NC} "
70+ git fetch origin
7671 git reset --hard " origin/$BRANCH "
7772 git clean -fd
78- echo -e " ${GREEN} Successfully reset to origin/ $BRANCH and cleaned worktree.${NC} "
73+ echo -e " ${GREEN} Successfully updated and cleaned worktree.${NC} "
7974 else
80- echo -e " ${YELLOW } Skipping repository update. Using existing local code.${NC} "
75+ echo -e " ${BLUE } Skipping update. Using existing local code.${NC} "
8176 fi
8277 else
8378 # Directory exists but is NOT a git repo (e.g. manual mkdir or unzip)
You can’t perform that action at this time.
0 commit comments