#!/bin/bash
echo "Stash App Code..."
cd <YOUR_PATH>
branchName=$(git branch | grep \* | cut -d ' ' -f2)
if [[ $branchName != *"fatal"* ]]; then
echo -e "You are on branch: "$branchName
echo "Let's save your work... /o.o/"
read -p " > Enter Stash Name: " stash_Name
# if var is empty
if [ -z "$stash_Name" ]
then
echo "_Nothing was entered :c, try again."
else
echo "Adding all files to Stash..."
git add .
stashIdentifier=$stash_Name
echo "stashing... : "$stashIdentifier
git stash save stashIdentifier
echo "*** Done :) ***"
fi
fi
First, change its permissions.
chmod 755 myScript
cp myScript.sh /usr/local/bin/myScript
Your type on terminal:
myScript