DataCareerHub
Explore learning
← Shared foundationsFree companion · 25 minute suggested activity

Understand working files, staging and commits

Git & collaboration · Shared foundation workshop · Create an inspectable local change history without publishing anything.

Learn → Try → ExplainReviewed 2026-10-15
01

Objective & prerequisites

Create an inspectable local change history without publishing anything. Prerequisites: basic Python expressions and files; use a disposable local practice folder and fictional data. This shared workshop complements the existing data/AI tracks and does not create a second progress system.

02

Understand the concept

Git records snapshots of selected content. The working tree is what you are editing; the index is the proposed next snapshot; a commit identifies a recorded snapshot and its parents. A file existing on disk does not mean it is tracked. Review staged changes before committing. A remote repository is a separate sharing destination, not required for local history.

03

Worked example

The reference creates a temporary repository, adds only README.txt and .gitignore, then records a scoped brief. Its fake .env is intentionally ignored. No global configuration, network remote or production repository is changed.

git status
git diff
git diff --cached
git log --oneline
04

Try it yourself

Run the Git unit test. Explain why git diff and git diff --cached can show different changes. Add an extra fictional note only in your own disposable repository. Record your prediction before running the supplied reference, then compare the observed result and explain any difference.

Worked solution

The first commit contains two named files and excludes .env. git diff compares unstaged edits; --cached compares staged changes with the last commit. Inspect git status before each operation. An ignored file already committed would require a separate reviewed remediation; .gitignore does not erase history.

06

Knowledge check

Does adding a filename always commit its latest future edits? Try answering without rereading the example.

Check and explain

No. git add stages a snapshot at that moment; later edits need another deliberate stage and review.

08

Mini-project, mistakes & handover

Produce a short README with the question, exact local command, input meaning, checks and actual results. Include one failure case and its explanation. Never silently turn an exception into a passing result. Mark simulated behavior explicitly, credit the supplied teaching code and identify your own contribution. These activities are unsaved self-practice, not certification.

09

Authoritative reference

Read the official reference ↗

— consulted for the underlying interface/concept. The lesson and fictional examples are original teaching material. Python reference tested with 3.12; designed for 3.10+. Git lab requires Git 2.28+.

Make the reasoning yours.

Try the activity before reading its reference. Keep your sources, commands and assumptions with your work. Companion activities are unsaved self-practice and do not award a certificate or change lesson progress.

Resume guidance and examples are for learning and preparation only. They do not guarantee interviews, a job offer or employment.

Public registration, payments and new paid enrolment remain disabled. These free resources do not grant access to protected course modules.

Learner dashboard ↗ · Ask a question ↗