Skip to content

Create Repository Workflow

Beginner~10 min

What you'll build

A local Git repository with a README.md file and one commit. You will run every command yourself and read the output at each step.

Goals

  • Initialize a new repository with git init
  • Create and stage a file with git add
  • Record a snapshot with git commit
  • Inspect repository state with git status and git log

Prerequisites

  • Git installed and available on the command line
  • A terminal or the EZ4Code playground shell

Steps

  1. 1

    Create the project folder and init

    Create a new empty directory and run git init inside it. This turns the folder into a Git repository by creating a hidden .git directory that stores all history.

    Code
    mkdir my-first-repo
    cd my-first-repo
    git init

    Expected result

    Git prints "Initialized empty Git repository in .../my-first-repo/.git/".

  2. 2

    Create a README file

    Create a README.md with a title line. The README is the front page of a repository — every project should have one.

    Code
    echo "# My First Repo" > README.md

    Expected result

    A file README.md exists in the folder with one line of content.

  3. 3

    Stage and check status

    Run git add to stage the file, then git status to see what will be committed. Staging is the step between your working files and the committed snapshot.

    Code
    git add README.md
    git status

    Expected result

    git status shows README.md in green under "Changes to be committed".

  4. 4

    Make your first commit

    Run git commit with a message. The message describes what this snapshot contains. Check the log to see your commit recorded in history.

    Code
    git commit -m "Add README"
    git log

    Expected result

    git log shows one commit with your message, author, and timestamp.

Try it yourself

What you learned

You practiced the complete first-repository workflow: init, add, commit, status, log. These five commands are the foundation of every Git session.

Related Resources

Related Lessons

  • Git Basics

    The init, add, commit, status, and log commands used here.

Related Practice

Related Tools

Related Cheatsheets

Related Reference

Related Errors

Related Glossary

  • Repository

    Understand what a repository is.

  • Commit

    What a commit represents.

  • Clone

    Cloning a remote repository.

Related Glossary

A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.

  • Repository

    Understand what a repository is.

  • Commit

    What a commit represents.

  • Clone

    Cloning a remote repository.

Related Errors

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

← Back to topic