liveBook · Manning

Repository

As explained in Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

A repository is a structured storage location containing a project's files and their associated version-control history.

A repository is a project folder that Git watches, combining working files with version-control history. Run Git commands from the repository’s root directory. section 19.3

A local repository provides:

  • A hidden .git directory that stores Git’s management data; do not modify it directly. section 19.3.1
  • A main branch created during initialization, with additional branches available later. section 19.3.1
  • Status tracking that distinguishes tracked files from untracked project files. section 19.3.1

Initialize a PowerShell project

Create and enter a project folder, then run git init. Git reports an empty repository on the main branch. After adding file1.ps1 and file2.ps1, git status identifies them as untracked until they are added to source control. section 19.3 section 19.3.1

PS C:\MyPSTool> git init
Initialized empty Git repository in C:/MyPSTool/.git/
PS C:\MyPSTool> Get-ChildItem      -Hidden
    Directory: C:\MyPSTool
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d--h--        6/14/2023   3:26 PM                .git

Inspect the folder after initialization to see the hidden .git directory that marks it as a repository. section 19.3.1

How Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools covers it

How deep it goes
Explains initialization, repository roots, branches, hidden metadata, and tracked status, then stops short of Git internals.
Examples
Demonstrates a MyPSTool folder, PowerShell files, git init, git status, GitHub remotes, and cloning a SharePoint tools repository.
What it assumes
Assumes basic PowerShell folder navigation and Git availability, while demonstrating repository initialization from the beginning.
What you can do after
Operate/configure a local Git repository, inspect its status, and connect it to a GitHub remote.
How it connects
Connects repositories with Git, branches, commits, remote repositories, GitHub, cloning, pushing, fetching, and pulling.

Also explained in

Compare how 10 books explain repository →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools. The section links point to the parts of the book it draws on.