Created
December 12, 2024 14:42
-
-
Save DMeurer/dcf36938362117d68cbf6de1c7b12fc9 to your computer and use it in GitHub Desktop.
Auto-Backup a Git Repository. You can run it in Autostart or from TaskScheduler, etc. It will display MERGE CONFLICT and pause if you got one, otherwise it will just close itself. I'm using it to Backup a KeePass File.
This file contains hidden or 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
git stash -u | |
git pull | |
git stash pop | |
$outp = $null; | |
$outp = git ls-files -u | |
if ($outp -eq $null){ | |
Write-Host "No conflics" -ForegroundColor Green | |
} else { | |
Write-Host "===== MERGE CONFLICTS =====" -BackgroundColor DarkRed | |
pause | |
} | |
git add . | |
git commit -m "backup" | |
git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment