export PATH=/usr/local/php8.1/bin:"$PATH"

alias php=/usr/local/php8.1/bin/php

alias composer="php /home/macromm/composer.phar"

alias npm="npm-node12"

switch-branch() {
  # Check if a branch name was provided as a parameter
  if [ $# -eq 0 ]; then
    echo "Please provide a branch name as a parameter."
    return 1
  fi

  # Check if there are any uncommitted changes
  if ! git diff-index --quiet HEAD --; then
    # Stash any uncommitted changes
    git stash save "Switching to branch $1"
  fi

  # Switch to the specified branch
  git checkout "$1"

  # Fetch the latest changes from the remote branch
  git fetch origin "$1"

  # Reset the local branch to match the remote branch
  git reset --hard "origin/$1"

  echo "Switched to branch $1 and updated it with the latest changes from the remote branch."
}
to-prod() {
  cd ../abiofore/
  git pull origin dev
  cd ../abiofore_dev
}
