Skip to content

Instantly share code, notes, and snippets.

@pvroegh
Last active October 19, 2022 07:38
Show Gist options
  • Save pvroegh/633da28e615fe0e7101dc3a206b2b31a to your computer and use it in GitHub Desktop.
Save pvroegh/633da28e615fe0e7101dc3a206b2b31a to your computer and use it in GitHub Desktop.
This script will sync a specified Git repository.
# This script will sync the specified Git repository.
# Schedule this script with the scheduler of your choosing to automate it.
$RepoPath = "C:\Repositories\brain2.0\"
cd $RepoPath
git pull
# Detect if there are any git changes.
$HasChanges = git status --porcelain
if (-Not $HasChanges)
{
Exit
}
git pull
git add .
git commit -q -m "Last Sync: $(Get-Date -Format f)"
git push -q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment