ProgramGuru

Create your first Git repository

Create your first Git repository

We will create a tiny notes project. The files are intentionally simple so the version-control behavior stays visible.

What you’ll learn

  • Initialize a repository.
  • Recognize untracked files.
  • Use git status to inspect repository state.

A repository begins locally

  1. Folder

    Create ordinary project files.

    README.md
  2. git init

    Add Git repository metadata.

    .git
  3. git status

    Inspect what Git currently knows.

    untracked / modified / staged
untracked / modified / staged

git init starts tracking capability, not automatic tracking

git init creates the repository metadata. It does not automatically create a commit and it does not mean every file is already tracked.

git status is your safest first diagnostic command. It reports the current branch, tracked changes, staged changes and untracked files.

Initialize a project and inspect its status

Run this in a disposable practice repository unless the lesson explicitly says otherwise.

mkdir notes-app
cd notes-app
git init
printf "# Notes App\n" > README.md
git status

README.md appears as untracked because Git sees the file but no commit currently includes it. The repository is local; no GitHub repository has been created by these commands.

Practice: Create your first repository

Your task: Add two more files, notes.txt and ideas.txt, without staging them. Run git status and predict which section they appear under.

Common pitfall to avoid

Avoid deleting or manually editing files inside .git unless you are deliberately repairing internals and know the consequences. Most everyday work should happen through Git commands.

Check your understanding

Immediately after git init and creating README.md, what is README.md?
Choose one answer. You can try again.

Answer and explanation

An untracked working-tree file until you stage it.

Correct.

Create your first repository: what to remember

Create your first Git repository is complete when you can explain the state being changed before you run the command, not merely repeat the syntax.

Read further: official supporting documentation.

Reaching the recap and completing the quizzes are separate milestones.

    Next lesson: Understand the working tree, staging area and repository →