42 lines
1.1 KiB
PowerShell
42 lines
1.1 KiB
PowerShell
Clear-Host
|
|
|
|
Write-Host "Opciones de commit:" -ForegroundColor Cyan
|
|
Write-Host "1. Pegar mensaje de commit (recomendado para mensajes largos)"
|
|
Write-Host "2. Escribir mensaje simple"
|
|
Write-Host ""
|
|
|
|
$opcion = Read-Host "Seleccione una opción (1/2)"
|
|
|
|
if ($opcion -eq "1") {
|
|
Write-Host "`nPASTE su mensaje de commit y presione CTRL+Z seguido de ENTER:" -ForegroundColor Yellow
|
|
$mensaje = @()
|
|
while ($line = Read-Host) {
|
|
$mensaje += $line
|
|
}
|
|
$mensajeFinal = $mensaje -join "`n"
|
|
} else {
|
|
$mensajeFinal = Read-Host "`nIngrese el mensaje de commit"
|
|
}
|
|
|
|
Write-Host "`nAgregando archivos..."
|
|
git add .
|
|
|
|
Write-Host "Creando commit..."
|
|
git commit -m $mensajeFinal
|
|
|
|
Write-Host "Haciendo push a la rama develop..."
|
|
$pushOutput = git push origin develop 2>&1
|
|
|
|
# Revisar si fallo la autenticacion
|
|
if ($pushOutput -match "Authentication failed" -or $pushOutput -match "Failed to authenticate") {
|
|
Write-Host "`nERROR: Fallo la autenticacion. Ejecutando git init para reconfigurar..." -ForegroundColor Red
|
|
|
|
git init
|
|
|
|
Write-Host "Intentando push nuevamente..."
|
|
git push origin develop
|
|
}
|
|
|
|
Write-Host "`nProceso finalizado."
|
|
|