#!/bin/sh
echo "\033[31m Reset Gitlab Code Script \033[0m"
echo "show gitlab branch";
git branch
echo "show gitlab tag list";
git tag
echo "\033[31m show tag info \033[0m"
read -p "Please input your tagName:" tagName
git show $tagName
commitID=$(`echo git show "${tagName}"`| awk '{print $2}'|sed -n '1,1p')
echo "\033[31m this tag commitId is $commitID \033[0m"
read -p "Please input your operation(reset/show):" operation
case $operation in
"reset")
echo "\033[31m Your choose is reset,reset commitId begin ... \033[0m"
# reset commend
# git reset --hard $commitID
echo "\033[32m reset success \033[0m"
git status
;;
"show")
echo "Your choose is show!"
git status
exit 0;
;;
*)
echo "Your choose is error!"
exit 0;
;;
esac
read -p "Do you want to push changes to the remote master branch(yes/no):" op
case $op in
"yes")
echo "\033[31m Your choose is yes,push master begin ... \033[0m"
#push commend
#git push origin master
echo "\033[32m push success \033[0m"
git status
;;
"no")
echo "Your choose is no!"
git status
exit 0;
;;
*)
echo "Your choose is error!"
exit 0;
;;
esac
Git通过tag回滚代码
Scroll Down© 本文著作权归作者所有,转载前请务必署名