Create Repository Workflow
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
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.
Codemkdir my-first-repo cd my-first-repo git initExpected result
Git prints "Initialized empty Git repository in .../my-first-repo/.git/".
- 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.
Codeecho "# My First Repo" > README.mdExpected result
A file README.md exists in the folder with one line of content.
- 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.
Codegit add README.md git statusExpected result
git status shows README.md in green under "Changes to be committed".
Hint
Use git add . to stage all changes at once, but be careful — it stages everything.
- 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.
Codegit commit -m "Add README" git logExpected result
git log shows one commit with your message, author, and timestamp.
Try it yourself
# Run these commands in a terminal, one at a time
mkdir my-first-repo
cd my-first-repo
git init
# TODO: create README, add, commit, logmkdir my-first-repo
cd my-first-repo
git init
echo "# My First Repo" > README.md
git add README.md
git status
git commit -m "Add README"
git logWhat 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
- Git Commands MCQ
Quiz on what each basic Git command does.
- Git Workflow Predict
Predict the state of a repo after a sequence of commands.
Related Tools
- .gitignore Generator
Generate a .gitignore file for your new repository.
- Markdown Previewer
Preview your README.md rendered as HTML.
Related Cheatsheets
- Git Cheatsheet
Quick reference for every command used in this project.
Related Reference
- Git Commands Reference
Complete reference for init, add, commit, status, and log.
Related Errors
- Not a Git Repository
Common git init mistakes.
- Uncommitted Changes
Working with uncommitted changes.
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.
- Not a Git Repository
Common git init mistakes.
- Uncommitted Changes
Working with uncommitted changes.