How to make Powershell script to execute git command?

Solution 1:

cd in Powershell an alias for Set-Location which is cd, and if the Git command line executable is in your path, you can call it from Powershell as well.

cd C:\path\to\myrepo.git\
git pull

or

Set-Location C:\path\to\myrepo.git\
Git pull

The second solution is more idiomatic for Powershell. And remember, if the path to your repo contains spaces, you must put it between quotes.