Arc 1 Quest 03

The First Scroll

git init, add, commit, status, log

The corridors of the Citadel of Knowledge echo with your footsteps as you head toward the Hall of Archives. After understanding how Git organizes work in its Three Halls, it's time to take action. The Master Archivist awaits you in front of a desk covered with blank scrolls.

"Enough theory, young apprentice. Today, you will create your first archive and seal your first documents within it. This is the fundamental act of every Archivist: observe, record, seal. Every scroll you archive will bear your mark in the kingdom's history. Let's begin."

Commands in detail

git init - Create a new repository

The command git init transforms a simple folder into a Git repository. It creates a hidden subfolder .git/ that contains all of Git's internal mechanics (history, configuration, objects...).

mkdir mon-projet
cd mon-projet
git init -b main

Expected output:

Initialized empty Git repository in /chemin/vers/mon-projet/.git/

You can verify that the .git/ folder was created:

ls -la
# You will see a .git/ folder

Never manually touch the contents of the .git/ folder. It's Git's vault - let it manage its own affairs.

git status - Check the repository state

This is the command you'll use most often. It tells you exactly where your files stand:

git status

Files appear in color:

  • Red - files that are modified or new, but not yet in the staging area (Working Directory)
  • Green - files ready to be sealed (in the Staging Area, awaiting commit)
  • Nothing - everything is clean, no modifications in progress

Make it a habit to type git status before and after every action. It's your compass - it always tells you where you stand.

git add <file> - Add to staging

This command moves a file from the Working Directory to the Staging Area (the Preparation Hall, seen in quest 02). It's the preparation step before the final sealing.

# Add a specific file
git add mission.txt

# Add multiple files
git add file1.txt file2.txt

# Add ALL modified or new files
git add .

After a git add, run a git status: the file should switch from red to green.

git add . adds everything at once. It's convenient, but be careful not to include unwanted files (temporary files, personal configuration files, etc.). When you're starting out, prefer adding files one by one to maintain full control over what you're doing.

git commit -m "message" - Seal into the archive

The commit is the act of sealing: you take everything in the Staging Area and permanently archive it in the Repository with an explanatory message.

git commit -m "Add the northern border observation report"

Expected output:

[main (root-commit) a1b2c3d] Add the northern border observation report
 1 file changed, 15 insertions(+)
 create mode 100644 mission.txt

Git gives you:

  • The branch you're on (main)
  • A shortened unique identifier (a1b2c3d) - this is the commit's seal
  • The message you wrote
  • A summary of changes (files modified, lines added/removed)

Anatomy of a good commit message

The commit message is essential: it's what others (and your future self in six months) will read to understand why a change was made. The goal is to record each modification in a clear and readable way.

The golden rules:

Rule Good example Bad example
Start with a verb in the imperative Add the contact page Added the page
Keep it short (50 chars max) Fix the tax calculation I fixed the bug in the calculation...
Be descriptive Remove debug logs fix
Describe the why Limit upload to 5 MB to avoid timeouts Change the MAX_SIZE variable

Add the registration form

Fix menu display on mobile

Remove temporary build files

Update security dependencies

Refactor the score calculation function

fix

update

changes

wip

asdfgh

fix the thing

If you can't summarize your commit in one short sentence, maybe you've done too many things at once. A good commit = one single logical change.

Practical exercise - Step-by-step mission

The Master Archivist entrusts you with your first official mission. Follow the steps in order.

Step 1: Create your archive

Create a folder called mon-archive/ and initialize a Git repository inside:

mkdir mon-archive
cd mon-archive
git init -b main

Verify that everything is in order:

git status

You should see: On branch main (or master) and nothing to commit.

Step 2: Retrieve the mission order

Copy the file parchemins/mission.txt (provided with this quest) into your mon-archive/ repository:

# From the mon-archive/ folder, copy the mission.txt file
# Adjust the path based on your quest location
cp ../parchemins/mission.txt .

Verify with git status - the file should appear in red (untracked).

Step 3: First sealing (commit)

Add the file to the staging area, then seal it:

git add mission.txt
git status          # mission.txt should be GREEN now
git commit -m "Add the Guild's mission order"

Choose a descriptive commit message! No "Initial commit" or "test". Describe what you're actually doing.

Step 4: Complete the mission

Open mission.txt in your favorite text editor and fill in the observation fields. For example:

- Lieu : Forêt de Sombrebois, poste d'observation n°7
- Créature observée : Wyverne à écailles argentées
- Niveau de danger (1-5) : 4
- Notes : Aperçue à l'aube, semble nicher dans les falaises est

Save the file.

Step 5: Second sealing

Run git status to see the modification, then archive it:

git status          # mission.txt in RED (modified)
git add mission.txt
git commit -m "Complete the border observation report"

Step 6: Check the history

View the history of your archive:

git log --oneline

You should see your two commits, from newest to oldest:

b2c3d4e Complete the border observation report
a1b2c3d Add the Guild's mission order

Step 7: Quest validation

Run the verification script from your mon-archive/ folder:

Bash (Linux / macOS / Git Bash):

bash ../verifier.sh

PowerShell (Windows):

..\verifier.ps1

The script checks:

  1. You are inside a Git repository
  2. You have at least 2 commits
  3. The file mission.txt is tracked by Git
  4. Your first commit message is personalized (not "Initial commit")
  5. You have completed the scroll (mission.txt differs from the shipped template)

Command summary

Command Description
git init Initialize a new Git repository
git status View file states (modified, staged, committed)
git add <file> Add a file to the staging area
git add . Add all modified files to staging
git commit -m "msg" Create a commit with a message
git log --oneline Display commit history (short format)

The Master Archivist examines your archive carefully. A smile forms on his face.

"Excellent work, apprentice. You now know how to create an archive, record documents within it, and seal your modifications. These gestures will soon become second nature. In the next quest, you'll discover that archives aren't limited to your desk - they can travel across the entire kingdom. Prepare yourself."