Last active
June 6, 2018 00:17
-
-
Save armand1m/df6e8f8446450a128e62 to your computer and use it in GitHub Desktop.
commit, push, reset, checkout e merge branch atual com destino.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if branch=$(git symbolic-ref --short -q HEAD) | |
then | |
echo "Branch atual: $branch" | |
echo | |
else | |
echo "Erro: Nenhuma branch encontrada. Provavelmente o diretório não é um repositório git." | |
exit | |
fi | |
echo -n "Destino: " | |
read destino | |
echo -n "Mensagem do commit: " | |
read commitmsg | |
commit="git commit -m '$commitmsg'" | |
pull="git pull" | |
push="git push" | |
reset="git reset --hard" | |
checkout="git checkout $destino" | |
merge="git merge origin/$branch" | |
cmd="$commit && $push && $reset && $checkout && $pull && $merge" | |
echo | |
echo "Comando à ser executado: " | |
echo "$cmd" | |
echo | |
echo -n "Confirma? [s, n]: " | |
read confirm | |
if [ $confirm == "s" ]; then | |
$commit | |
$push | |
$reset | |
$checkout | |
$pull | |
$merge | |
else | |
echo "Cancelado." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment