Skip to content

Instantly share code, notes, and snippets.

@armand1m
Last active June 6, 2018 00:17
Show Gist options
  • Save armand1m/df6e8f8446450a128e62 to your computer and use it in GitHub Desktop.
Save armand1m/df6e8f8446450a128e62 to your computer and use it in GitHub Desktop.
commit, push, reset, checkout e merge branch atual com destino.
#!/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