Last active
July 19, 2016 20:22
-
-
Save kauemorelli/36cf9ec840c6ddf0f5b706df31094b3b to your computer and use it in GitHub Desktop.
This file contains 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 | |
# Functions | |
function branchInicial { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/' | |
} | |
function fileToCommit { | |
#git whatchanged -1 --format=oneline | wc -l | |
git ls-files --others -m --exclude-standard | wc -l | |
} | |
# Script | |
echo -e "\033[01;36m*****************************************************************************\033[0m" | |
echo -e "\033[01;36m**************************** Resolving Conflicts ***************************\033[0m" | |
echo -e "\033[01;36m*****************************************************************************\033[0m" | |
echo "" | |
echo -e "******************************* Current Status ********************************" | |
echo -e "\033[01;1;37mBranch current:\033[01;31m$(branchInicial)" | |
echo -e "\033[0m" | |
#git ls-files --others --exclude-standard 2> /dev/null | |
echo -e "\033[01;1;Files to commit: \033[01;31m$(fileToCommit)\033[0m" | |
echo "" | |
echo -e "***************************** Parameters Info *******************************" | |
echo -e "\033[01;1;37mTask Branch (Branch da Tarefa):\033[01;31m $1" | |
echo -e "\033[0m" | |
echo -e "\033[01;1;37mBranch Package (Branch do Pacote):\033[01;31m $2" | |
echo -e "\033[0m" | |
echo -e "*****************************************************************************" | |
echo "" | |
#test $(fileToCommit) == '3' && (echo $(statusBranch); exit 1) | |
#test $(fileToCommit) == '0' && (echo $(statusBranch); (echo diferente de 3)) | |
if test $(fileToCommit) -eq 0; | |
then | |
echo "Igual a 0" | |
echo "Entering the task branch" | |
#echo "Entrando na branch da Tarefa" | |
git checkout $1 | |
git pull origin $1 | |
echo "Creating and going to new Branch" | |
#echo "Criando e indo para nova Branch" | |
git branch $1 + "-RC" | |
git checkout $1 + "-RC" | |
echo "Bringing Branch Package" | |
#echo "Trazendo a Branch do pacote" | |
git git pull origin $2 | |
echo "Generating the compiled files (Add command of the task GruntJS with minification file)" | |
#echo "Gerando os Arquivos compilados (Adicionar o comando da task do GruntJS com a minificação dos arquivos)" | |
grunt prod | |
echo "Commint" | |
#echo "Comitando" | |
git add --all | |
git commit -m "Resolvend conflict (bash)" | |
echo "Making the PUSH Branch" | |
#echo "Efetuando PUSH na Branch" | |
git push origin $1 + "-RC" | |
echo "Returning to the previous Branch" | |
#echo "Voltando à Branch anterior" | |
git checkout $(branchInicial) | |
else | |
echo "Diferente de 0" | |
echo "Changes in current branch not 'commited' are being added to the stash" | |
#echo "Alterações na branch atual não comitadas estao sendo adicionadas no stash" | |
git add . && git stash | |
echo "Entering the branch Task" | |
#echo "Entrando na branch da Tarefa" | |
git checkout $1 | |
git pull origin $1 | |
# | |
echo "Criando e indo para nova Branch" | |
git branch $1 + "-RC" | |
git checkout $1 + "-RC" | |
# | |
echo "Trazendo a Branch do pacote" | |
git git pull origin $2 | |
# | |
echo "Gerando os Arquivos compilados" | |
grunt prod | |
# | |
echo "Comitando" | |
git add --all | |
git commit -m "Resolvend conflict (bash)" | |
# | |
echo "Efetuando PUSH na Branch" | |
git push origin $1 + "-RC" | |
# | |
echo "Voltando à Branch anterior" | |
git checkout $(branchInicial) | |
echo "Returning files" | |
#echo "Voltando os arquivos" | |
git stash apply | |
fi | |
#git status 2> /dev/null | sed -e '/^[^nothing to commit, working directory clean]/d' | |
#git status 2> /dev/null | sed -e '/^[^Changes not staged for commit:]/d' | |
#git status 2> /dev/null | sed -e '/^[^Untracked files:]/d' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created bash to solve CSS file conflicts when minified.