Morning routine - updating git repos

Fetch pending changes for all git repositories in a directory using PowerShell

Morning routine - updating git repos
  • Get to work
  • Clock in
  • Make coffee
  • Fetch latest changes from git....

Going through a half dozen repositories that I regularly interact with involves far more typing than I care to do repeatedly.

What I want is to cycle through each repository and do the following

  • git fetch --prune
  • If I'm on the default branch (usually master or develop) and have no local changes then just git pull straight away

Sounds perfect for automation! PowerShell to the rescue, leaving time to savour the coffee

Share Tweet Send