1
0
mirror of https://gitlab.com/JKANetwork/jka-toolkit.git synced 2026-02-14 17:11:32 +01:00
Files
jka-toolkit/jka-toolkit/gitdit
2016-06-28 16:05:01 +02:00

42 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
VERSION="0.1.3"
gitopt=`dialog --stdout --scrollbar --menu "gitdit - Git DIalog inTerface" 0 0 6 p "Descargar actualizaciones del git (Hacer pull)" s "Subir actualizaciones al git (Hacer push)" c "Descargar un nuevo git (Hacer clone)" b "Cambiar de branch/rama (Hacer checkout)" m "Unir ramas (Hacer merge)"`
actual="origin $(git branch --list | grep "^*" | cut -f1 -d" ")"
case $gitopt in
"p") git pull $actual;;
"s") commit=`dialog --stdout --inputbox "Cambios (texto commit)" 10 50 "changes"`
if [[ -z $commit ]];then
commit="changes"
fi
git add . && git commit -m "$commit" && git push $actual
;;
"c")
giturl=`dialog --stdout --inputbox "URL del git" 10 60`
git clone $giturl
;;
"b")
j=0
rama=""
for i in $(git branch --list | grep "^*" -v )
do
if [ $i != "*" ];then
rama="$rama $j $i"
lista[$j]=$i
let j++
fi
done
ramificacion=`dialog --stdout --scrollbar --menu "Selecione la rama" 0 0 6 $rama`
git checkout ${lista[$ramificacion]}
;;
"m")
until [[ $gitbusing && $gitbmerge ]]
do
gitbusing=`dialog --stdout --inputbox "Rama actual" 10 60`
gitbmerge=`dialog --stdout --inputbox "Rama con la que unir (la final,normalmente master)" 10 60 "master"`
done
git checkout $gitbmerge
git merge $gitbusing
git push
;;
esac