Skip to content

Instantly share code, notes, and snippets.

@leandro-hermes
Last active October 26, 2020 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leandro-hermes/bc399e21547e1e1d8db4013afe668210 to your computer and use it in GitHub Desktop.
Save leandro-hermes/bc399e21547e1e1d8db4013afe668210 to your computer and use it in GitHub Desktop.
Limpa branches do repositório local e aplica o git flow
echo "
####
# Baixando repo atualizado
####
"
git fetch origin -p
git checkout main
echo "
####
# Removendo branches
####"
BRANCHES=$(git branch | awk -F ' +' '! /\(no branch\)/ {print $2}')
for branch in $BRANCHES; do
if [ $branch != "main" ]; then
git branch -D "$branch"
fi
done
echo "
####
# Inicializando Git Flow
####"
printf "%s\n%s\n\n\n%s\n\n\n%s\n\n" main develop homolog/ v | git flow init -f
echo "
####
# Sincronizando branch 'develop' com 'origin'
####"
git checkout develop
git branch -u origin/develop
[ -f "gitflow.sh" ] && rm -f gitflow.sh
echo "Concluído"
@leandro-hermes
Copy link
Author

leandro-hermes commented Oct 26, 2020

Depois de instalar o git-flow, fazer o seguinte em cada repositório:

wget https://gist.githubusercontent.com/leandro-hermes/bc399e21547e1e1d8db4013afe668210/raw/65b7d7a0e091b3d93a5119a982384df58cb34abc/gitflow.sh
sudo chmod +x gitflow.sh
./gitflow.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment