Using Git

Here is a complete, step-by-step breakdown of how to initialize and use Git locally on a brand-new project.

Phase 1: Setting Up Your Machine (One-Time Setup)

Before initializing Git on a project, Git needs to know who you are. If you haven’t done this already on your computer, open your VS Code terminal and run these two commands once:

Bash

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

Phase 2: Launching Git on a New Project

When you create a brand-new folder on your desktop or open an empty workspace in VS Code, Git doesn’t watch it automatically. You have to “turn Git on.”

1. Initialize the Repository

Make sure your terminal path matches your project directory (just like your C:\Users\...\moondog-development path from earlier), then run:

Bash

git init

What this does: This creates a hidden .git folder inside your directory. This hidden folder acts as your local database, tracking every character change, file addition, and deletion.

2. Check the Workspace Status

Before doing anything else, always check the room:

Bash

git status

What this does: It tells you what branch you are on (usually main or master) and lists any files that Git sees but isn’t tracking yet (untracked files will appear in red).

Phase 3: The Three-Tree Architecture (The Daily Workflow)

Local Git relies on a simple three-step cycle to save your work: Working Directory $\rightarrow$ Staging Area $\rightarrow$ Local Repository.

Plaintext

[ Working Directory ]  --->  ( git add )  --->  [ Staging Area ]  --->  ( git commit )  --->  [ Local Repository ]
  (Making changes)                               (Prepping files)                               (Saved Snapshot)

Step 1: Prepare Your Files (Staging)

When you alter or create files, they sit in your Working Directory. To pack them into a box before saving, you “stage” them.

To stage a single specific file:

Bash

git add filename.txt

To stage all changed and new files in the folder at once:

Bash

git add .

Step 2: Seal the Box (Committing)

Once your files are in the Staging Area, you permanently lock them into your local Git history with a message explaining what you did.

Bash

git commit -m "feat: add initial project layout structure"

Rule of Thumb: Keep your commit messages clear and present-tense (e.g., feat: ..., fix: ..., docs: ...). A commit is like a local save-state in a video game—you can always jump back to it if your project breaks later.

Step 3: Review Your History

To verify that your save-state was successfully recorded, look at your timeline:

Bash

git log --oneline

(Or use your custom git tree alias we set up earlier!)

Summary Checklist for New Projects

Whenever you start a new local project from scratch, your terminal sequence will always look exactly like this:

  1. git init (Turns on tracking—only do this once per project)
  2. git status (See what’s happening)
  3. git add . (Stage your initial files)
  4. git commit -m "Initial commit" (Lock in your baseline baseline state)

© 2026 All Rights Reserved.