Files
checklist/gitUpdate.ps1

38 lines
901 B
PowerShell

Clear-Host
# Pedir mensaje de commit (con soporte para saltos de línea)
Write-Host "Ingrese el mensaje de commit (presione Enter dos veces para finalizar):"
Write-Host ""
$lineas = @()
do {
$linea = Read-Host
if ($linea -ne "") {
$lineas += $linea
}
} while ($linea -ne "")
$mensaje = $lineas -join "`n"
Write-Host "`nAgregando archivos..."
git add .
Write-Host "Creando commit..."
git commit -m "$mensaje"
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."