# !/bin/bash
# maybe you are using bash,fix the first line.
# Program:
# THIS PROGRAM IS FOR GIT PUSH
# BEFORE USE THIS SCRIPT, YOU MUST ADD YOU GIT PRIVATE KEY,LIKE FOLLOW SHELL COMMAND.
# ssh-add you_ssh_private_key_path,like ssh-add ~/.ssh_github/id_rsa
# History:
# 2015/10 wikinee First release
# ENV
# ubuntu 14.04 LTS
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin/:~/bin
export PATH
echo "===========git config========="
echo "Ignore Permission"
git config core.fileMode false
echo "===========git branch========="
git branch
echo "===========git fetch==========="
echo "Input destination branch, must be already exist in remote.Enter use master:"
read to_branch
echo "Add tmp branch to store diff"
git fetch origin ${to_branch:=master}:tmp
echo "This time will modify following:"
git diff tmp
read -p "Merge it, y or Y?" yn
if [ "$yn" == "Y" ]||[ "$yn" == "y" ] ;then
echo $yn
echo "now merge it."
git merge tmp
else echo "Illeagal Character."
exit
fi
echo "===========git status========="
git status
echo "Input git add parameter,like -A"
read input1
git add $input1
echo "===========git commit========="
read -p "Git commit this changes?(y/n)" yn
if [ "$yn" == "Y" ]||[ "$yn" == "y" ] ;then
echo $yn
echo "Pow you can input commit message:"
elif [ "$yn" == "N" ]||[ "$yn" == "n" ] ;then
echo $yn
echo "Not Committed."
exit
else echo "illeagal character."
exit
fi
read input2
git commit -m "$input2" -a
echo "===========git push==========="
echo "Push to git?(y/n)"
read push_choice
if [ "$push_choice" == "y" ]||[ "$push_choice" == "Y" ] ;then
echo "Now push files,you can give parameter 1,default 'origin'."
read input3
echo "Now push files,you can give parameter 2,default 'master'."
read input4
git push -u $input3 $input4
else
echo "Already Commit, But Not Pushed"
fi
# maybe you are using bash,fix the first line.
# Program:
# THIS PROGRAM IS FOR GIT PUSH
# BEFORE USE THIS SCRIPT, YOU MUST ADD YOU GIT PRIVATE KEY,LIKE FOLLOW SHELL COMMAND.
# ssh-add you_ssh_private_key_path,like ssh-add ~/.ssh_github/id_rsa
# History:
# 2015/10 wikinee First release
# ENV
# ubuntu 14.04 LTS
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin/:~/bin
export PATH
echo "===========git config========="
echo "Ignore Permission"
git config core.fileMode false
echo "===========git branch========="
git branch
echo "===========git fetch==========="
echo "Input destination branch, must be already exist in remote.Enter use master:"
read to_branch
echo "Add tmp branch to store diff"
git fetch origin ${to_branch:=master}:tmp
echo "This time will modify following:"
git diff tmp
read -p "Merge it, y or Y?" yn
if [ "$yn" == "Y" ]||[ "$yn" == "y" ] ;then
echo $yn
echo "now merge it."
git merge tmp
else echo "Illeagal Character."
exit
fi
echo "===========git status========="
git status
echo "Input git add parameter,like -A"
read input1
git add $input1
echo "===========git commit========="
read -p "Git commit this changes?(y/n)" yn
if [ "$yn" == "Y" ]||[ "$yn" == "y" ] ;then
echo $yn
echo "Pow you can input commit message:"
elif [ "$yn" == "N" ]||[ "$yn" == "n" ] ;then
echo $yn
echo "Not Committed."
exit
else echo "illeagal character."
exit
fi
read input2
git commit -m "$input2" -a
echo "===========git push==========="
echo "Push to git?(y/n)"
read push_choice
if [ "$push_choice" == "y" ]||[ "$push_choice" == "Y" ] ;then
echo "Now push files,you can give parameter 1,default 'origin'."
read input3
echo "Now push files,you can give parameter 2,default 'master'."
read input4
git push -u $input3 $input4
else
echo "Already Commit, But Not Pushed"
fi