Examples to show Git from Powershell

View the Project on GitHub PaperCutSoftware/git-from-powershell

Git from the PowerShell Prompt

These notes support a demonstration and talk that introduces PowerShell users to Git and version control concepts. An hour talk is not very long and these notes are brief, so links to more complete material are provided.

Note: This content is written in British English

Git Logo
PowerShell Hero


Talk Video

Most folks in IT (application developers, system administrators, security engineers,…) create, and manage, text files of various types all day, every day. For example: scripts; data files of various types (such as config settings stored in JSON or CSV files); application source code and so on. Keeping track of changes, looking back at old versions and creating special purpose versions is unmanageable without a version control tool.

Git is the world’s most popular version control tool. This talk provides a novice introduction to using Git from the PowerShell prompt and no previous version control experience is assumed. As well as using Git locally, we will also look at storing version repositories on the GitHub cloud service.

Because this is an introduction additional resources will be provided to take people further on their Git journey.

Things we’ll talk about

In the following explanations we will talk about developers and that means you, because you write PowerShell scripts…

If you write code you’re a dev

Thomas Rayner

About Alec

Alec is an IT geek who currently works as a Developer Advocate at PaperCut Software in Melbourne, Australia. He’s been using computers since the late ’70s (an ICL 2904 mainframe) and he was a MS-DOS batch file (and later UNIX shell) wizard. More recently Alec has been learning PowerShell, he always has Windows Terminal open with both a PowerShell and WSL2 Bash prompt available. Recently he installed VS Code on his ARM64 Chrome OS tablet

What are the problems VCS solves and how?

Installing and configuring Git on Windows

A high level overview of Git

See also What is Git?

Everyday Git commands you need on the PowerShell prompt, with examples

The Git command line interface consists of the executable git followed by a command and the corresponding arguments and options. There are many commands and a myriad of options so it can seem a little overwhelming all at once, we will focus on the basic workflow commands.

Note that the Git CLI follows UNIX/Linux conventions, not PowerShell.

There are many links to help you discover the details.

Important commands

Don’t forget of course the git status and git log

Storing and sharing your files on GitHub

The GitHub website provides SaaS Git hosting. So you

  1. Keep your local project repos on your workstation
  2. Store the upstream bare project repos on GitHub (or some other similar SaaS service)

GitHub upstream repos can be managed from the PowerShell prompt

Install the GitHub CLI (gh) tool via Chocolaty

choco install gh

Now you can add your current project to GitHub

gh repo create --public

Push project code to GitHub

git push --set-upstream origin main

Now open the repository URL On GitHub.

What to read or watch next

Git for web developers

Video Playlist

Pro Git Book

Git cherry pick tutorial. How to use git cherry-pick