Skip to content

Instantly share code, notes, and snippets.

@vale981
Last active December 26, 2015 09:09
Show Gist options
  • Save vale981/7126963 to your computer and use it in GitHub Desktop.
Save vale981/7126963 to your computer and use it in GitHub Desktop.
Commit&Push v1
#!/bin/bash
clear;
red='\e[0;31m'
NC='\e[0m' # No Color
green='\e[0;32m'
if [ "$1" = "clear" ]; then
rm /tmp/.name.txt
rm /tmp/.remote.txt
else
echo #
fi
echo -e ${green}+++++++++++++++++++++++++++++++++++
echo -e +${red}Commit and Push script by vale981${green}+
echo -e +++++++++++++++++++++++++++++++++++
echo -e ${NC}
if [ -f /tmp/.name.txt ]; then
echo -e ${green}Working Direktory found...${NC}
echo
else
echo -n -e ${green}"Please enter working direktory: "${NC}
read dir
echo $dir > /tmp/.name.txt
echo
fi
echo -n -e ${green}'Please enter your commit message: ' ${NC};
read message
echo
DIRO=$(cat /tmp/.name.txt)
cd $DIRO
git add .
git commit -am "${message}"
echo #
echo -e ${green}++++++++++++++++++++++++++++++++++
echo -e +${red}Git Commit created, now pushing.${green}+
echo -e ++++++++++++++++++++++++++++++++++
echo -e ${NC}
if [ -f /tmp/.remote.txt ]; then
echo -e ${green}I know the remote...${NC}
echo
else
echo -n -e ${green}"Please enter remote server: "${NC}
read pob
echo $pob > /tmp/.remote.txt
echo
fi
echo -n -e ${green}"Please enter the branch you want to use: "${NC}
read branch
echo #
POB=$(cat /tmp/.remote.txt)
git push $POB $branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment