Developer Workstation, Terminal, Git & GitHub
Software work becomes dependable when the environment and history are understandable by another developer. This bridge lesson teaches terminal navigation, processes, environment variables, Git's data model, safe recovery, pull requests,…
- Explain Terminal and filesystem by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Git mental model by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Repository quality by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Trace the chapter's complete execution path and identify where memory, I/O, concurrency, persistence, or rendering cost accumulates.
- Build the worked example, make one failure visible, and defend the design in a review.
How to use this chapter
For Developer Workstation, Terminal, Git & GitHub, read the explanations first and predict every example before running it. Keep a learning repository containing code, tests, command output, and the short written submission. The roadmap checklist at the end audits coverage; the chapter itself follows the workstation learning arc appropriate to this subject.
The problem this chapter solves
Software work becomes dependable when the environment and history are understandable by another developer. This bridge lesson teaches terminal navigation, processes, environment variables, Git's data model, safe recovery, pull requests, documentation, and basic CI before language work begins.
A professional repository must be reproducible, reviewable, recoverable, and safe to automate before application code becomes valuable.
Learning outcomes
- Explain Terminal and filesystem by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Git mental model by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Explain Repository quality by naming its input, guarantee, internal lifecycle, important failure, and proof.
- Trace the chapter's complete execution path and identify where memory, I/O, concurrency, persistence, or rendering cost accumulates.
- Build the worked example, make one failure visible, and defend the design in a review.
Chapter progression
The order below is intentional: later sections depend on guarantees established earlier.
Runtime or system overview
The shell tokenizes a command, performs expansion and redirection, starts one or more operating-system processes, connects their standard streams, and receives exit statuses. Git separately stores content-addressed blobs, directory trees, commits, and movable references; GitHub adds hosted collaboration and automation around that graph. In Developer Workstation, Terminal, Git & GitHub, use that execution model to decide where the chapter's validation, state ownership, cleanup, and evidence belong.
Execution trace
- The shell resolves the current directory and starts each command with arguments and environment.
- Git hashes file contents and stages the selected snapshot in the index.
- Commit creates an immutable tree and parent-linked history node.
- Push transfers missing objects; review and CI verify the proposed branch independently.
- Merge advances or combines history only after review evidence succeeds.
Memory and performance lens
Shell variables and process environments are copied or constructed at process start; open file descriptors and child processes consume operating-system resources until closed or reaped. Git's object database grows with unique reachable content, while the index and working tree are mutable views used to create the next snapshot. For Developer Workstation, Terminal, Git & GitHub, connect those costs to the concrete operations in the topic sections rather than assuming the friendly surface syntax is cheap.
When tuning Developer Workstation, Terminal, Git & GitHub, measure command duration, exit status, file-descriptor/process cleanup, repository size, changed-file count, and CI duration rather than optimizing from source-code appearance.
1. Terminal and filesystem
The Terminal and filesystem unit begins with absolute vs relative paths: An absolute path identifies a location from a filesystem root; a relative path is interpreted from the process's current working directory. Use project-relative paths for portable repository content and resolve an explicit base directory for automation that must not depend on where it was launched. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
The operating-system and repository model: Terminal and filesystem
| Concept | Meaning | Engineering decision |
|---|---|---|
| absolute vs relative paths | An absolute path identifies a location from a filesystem root; a relative path is interpreted from the process's current working directory. | Use project-relative paths for portable repository content and resolve an explicit base directory for automation that must not depend on where it was launched. |
| files/directories and permissions | Files hold byte streams and metadata; directories map names to entries; permissions and ownership determine which identities may traverse, read, write, or execute them. | Create the narrowest directory tree required, quote paths containing spaces, and grant secrets only the access needed by the running identity. |
| processes, environment variables and exit codes | A process is one running program with its own identifier, arguments, environment, current directory, open streams, and numeric exit status. | Use environment variables for external, non-secret or securely injected configuration; use stderr for diagnostic text and exit codes for machine-readable success or failure. |
| pipes, redirection and command help | Redirection attaches a command's standard streams to files or devices; a pipe connects one process's standard output to another process's standard input. | Use pipes for bounded streaming transformations, redirect stdout and stderr deliberately, and inspect --help or manual pages before guessing flags. |
How the shell, kernel, and Git handle it: Terminal and filesystem
absolute vs relative paths. The shell passes a path string to an operating-system call. The kernel walks its components, following links according to the operation, and resolves . and .. relative to the process directory. The same relative text can therefore identify different files in different working directories.
files/directories and permissions. Opening an entry asks the kernel to resolve every parent directory and check access for the effective identity. File descriptors then represent open resources until the process closes them. On POSIX systems directory execute permission controls traversal, while file execute permission controls program execution.
processes, environment variables and exit codes. The shell constructs an environment and starts the executable. The child inherits or receives selected file descriptors and environment values, performs its work, then terminates with status 0 for success or a non-zero application-defined failure. The parent shell stores that status for conditional automation.
pipes, redirection and command help. Before starting children, the shell creates or opens the requested file descriptors and connects pipeline endpoints. Commands run concurrently, buffers apply backpressure, and the shell normally reports the last command's status unless a stricter pipeline option is enabled.
Read these as one system: absolute vs relative paths establishes the starting contract, files/directories and permissions changes how that contract is executed or represented, and pipes, redirection and command help exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
Commands in a real workflow: Terminal and filesystem
1pwd2ls -la3cd ./projects/api4realpath ../shared/config.yamlThis Terminal and filesystem slice makes absolute vs relative paths observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward pipes, redirection and command help, predict its behavior for empty, invalid, repeated, and large input.
Mistakes that damage state or history: Terminal and filesystem
| Risk | Why it matters |
|---|---|
| absolute vs relative paths | A script that assumes the caller's directory can read configuration from, or write output to, the wrong project. |
| files/directories and permissions | Recursive permission changes and unquoted paths can expose secrets or modify far more entries than intended. |
| processes, environment variables and exit codes | Printing an error but returning status 0 makes CI treat failure as success; dumping the environment can expose credentials. |
| pipes, redirection and command help | Ignoring an early pipeline failure can produce incomplete output that still appears successful; redirecting with overwrite syntax can destroy an existing file. |
Workstation drill: Terminal and filesystem
- Foundation: implement or demonstrate absolute vs relative paths with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine absolute vs relative paths with files/directories and permissions. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for pipes, redirection and command help. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
2. Git mental model
The Git mental model unit begins with working tree, staging area and commit graph: The working tree is the editable checkout, the staging area is the exact proposed next snapshot, and the commit graph is immutable history linked through parent commit IDs. Inspect both unstaged and staged diffs, stage related changes, and make each commit buildable and explainable. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
The operating-system and repository model: Git mental model
| Concept | Meaning | Engineering decision |
|---|---|---|
| working tree, staging area and commit graph | The working tree is the editable checkout, the staging area is the exact proposed next snapshot, and the commit graph is immutable history linked through parent commit IDs. | Inspect both unstaged and staged diffs, stage related changes, and make each commit buildable and explainable. |
| branching, merging and rebasing | A branch is a movable reference to a commit; merge combines histories, while rebase copies commits onto a different parent chain. | Use short-lived branches, merge when shared history should remain visible, and rebase private work to prepare a clean review when team policy permits. |
| remote tracking and pull requests | A remote names another repository; remote-tracking references record the last fetched view of its branches; a pull request is a hosted review and integration proposal. | Fetch before comparing, push a focused branch, explain the intent and testing, and address review through additional coherent commits or an agreed history update. |
| restore, revert and conflict resolution | Restore changes the working tree or index; revert creates a new commit that inverses a published change; conflict resolution supplies the combined content Git cannot infer. | Use restore for local uncommitted state, revert for published history, and run focused plus integration tests after resolving a conflict. |
How the shell, kernel, and Git handle it: Git mental model
working tree, staging area and commit graph. Git hashes file content into blobs, records directory trees, and creates a commit containing the root tree, parents, author/committer metadata, and message. The index sits between the working tree and commit object, so a commit can include only selected changes.
branching, merging and rebasing. A fast-forward moves a reference when no divergence exists. A true merge creates a commit with multiple parents. Rebase finds commits unique to the source, reapplies their patches, and creates new commit IDs because their parents and metadata change.
remote tracking and pull requests. git fetch transfers missing objects and updates names such as origin/main without modifying the local working branch. Pushing updates a permitted remote reference. A pull request compares commit reachability and diffs while checks and reviewers attach evidence.
restore, revert and conflict resolution. Git performs three-way comparison from a merge base. When both sides change overlapping content incompatibly, it records stages and writes conflict markers. After a human produces the intended file, staging marks it resolved and the merge/rebase continues.
Read these as one system: working tree, staging area and commit graph establishes the starting contract, branching, merging and rebasing changes how that contract is executed or represented, and restore, revert and conflict resolution exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
Commands in a real workflow: Git mental model
1git status2git add src tests3git diff --cached4git commit -m "feat: validate grade inputs"5git log --graph --oneline --decorate -10This Git mental model slice makes working tree, staging area and commit graph observable. Read it from the boundary inward: identify the input, the validation point, the state or operation, and the value that proves the result. Before extending it toward restore, revert and conflict resolution, predict its behavior for empty, invalid, repeated, and large input.
Mistakes that damage state or history: Git mental model
| Risk | Why it matters |
|---|---|
| working tree, staging area and commit graph | Using git add . without reviewing the staged diff can include secrets, generated files, or unrelated edits. |
| branching, merging and rebasing | Rebasing and force-pushing commits other people already use rewrites their base and creates avoidable recovery work. |
| remote tracking and pull requests | Treating origin/main as live without fetching or merging a pull request with failing/stale checks creates a false view of integration safety. |
| restore, revert and conflict resolution | Deleting conflict markers without reconciling both intentions can compile successfully while silently removing required behavior. |
Workstation drill: Git mental model
- Foundation: implement or demonstrate working tree, staging area and commit graph with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine working tree, staging area and commit graph with branching, merging and rebasing. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for restore, revert and conflict resolution. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
3. Repository quality
The Repository quality unit begins with README and reproducible setup: A README is the verified entry point that lets a new developer understand the goal, prerequisites, configuration, setup, commands, architecture, and known limitations. Test README instructions in a clean environment and keep them beside the version of code they describe. The rest of this section connects that guarantee to this unit's related roadmap concepts instead of treating each term as an isolated flashcard.
The operating-system and repository model: Repository quality
| Concept | Meaning | Engineering decision |
|---|---|---|
| README and reproducible setup | A README is the verified entry point that lets a new developer understand the goal, prerequisites, configuration, setup, commands, architecture, and known limitations. | Test README instructions in a clean environment and keep them beside the version of code they describe. |
| .gitignore and secret hygiene | .gitignore prevents matching untracked paths from being offered for normal staging; secret hygiene prevents credentials and sensitive data from entering source, history, logs, or build artifacts. | Ignore local environments and secrets, commit a safe example configuration, scan changes and history, and rotate any credential immediately after exposure. |
| semantic commits and review size | A semantic commit communicates the kind and scope of one coherent change; review size is the amount of behavior a reviewer must understand and verify at once. | Prefer an imperative subject, explain why in the body when necessary, separate mechanical refactors from behavior, and split work at independently verifiable boundaries. |
| basic CI verification | Continuous integration checks a clean copy of proposed history with versioned, repeatable commands before the branch is accepted. | Make local and CI commands equivalent, fail fast on formatting or static errors, run meaningful tests, and pin action and tool versions. |
How the shell, kernel, and Git handle it: Repository quality
README and reproducible setup. A reproducible setup starts from a clean checkout and declared tool/dependency versions. Its commands create isolated dependencies, apply schema/configuration steps, run tests, and demonstrate one critical path without relying on undocumented machine state.
.gitignore and secret hygiene. Ignore rules are matched by path pattern but do not affect files already tracked. Git history preserves committed blobs even after later deletion, and forks, caches, or logs may retain copies.
semantic commits and review size. Review systems compute file and line diffs between commit graphs, but human correctness depends on tracing intent across tests, configuration, migrations, and generated artifacts. Smaller cohesive changes reduce unrelated paths and make rollback or bisect evidence clearer.
basic CI verification. A runner checks out the commit, provisions declared tools, restores safe caches, installs locked dependencies, executes lint/type/test/build steps, and reports an immutable result tied to that commit. Required checks gate merging.
Read these as one system: README and reproducible setup establishes the starting contract, .gitignore and secret hygiene changes how that contract is executed or represented, and basic CI verification exposes a later boundary or failure condition. A local optimization is useful only when the combined behavior stays correct and observable.
Mistakes that damage state or history: Repository quality
| Risk | Why it matters |
|---|---|
| README and reproducible setup | Instructions that depend on an author's global packages, hidden files, or unexplained manual steps fail precisely when another developer needs them. |
| .gitignore and secret hygiene | Adding a leaked secret to .gitignore does not revoke it or remove earlier objects; rotation is the first recovery action. |
| semantic commits and review size | A huge mixed change can hide a security or logic defect even when every individual line looks reasonable. |
| basic CI verification | CI that depends on mutable tags, undeclared secrets, or order-dependent tests can pass one commit and fail the same source later. |
Workstation drill: Repository quality
- Foundation: implement or demonstrate README and reproducible setup with one valid input and one invalid input. Record the exact output or failure.
- Integration: combine README and reproducible setup with .gitignore and secret hygiene. Explain which component owns validation and cleanup.
- Production: design a test or experiment that exposes the failure described for basic CI verification. State the metric, assertion, or query plan that proves the correction.
What a strong checkpoint answer contains
- A precise boundary and typed or validated input.
- One named guarantee, not only a library call.
- A negative case that fails for the intended reason.
- Cleanup, transaction, retry, or cancellation behavior where applicable.
- Evidence: assertion, command output, plan, trace, metric, or accessible UI state.
Complete worked example
This example integrates the chapter rather than demonstrating an isolated method.
1mkdir professional-repository && cd professional-repository2git init3printf '# Professional Repository Starter\n' > README.md4printf '.env\n.venv/\n__pycache__/\n' > .gitignore5git add README.md .gitignore6git commit -m "chore: initialize reproducible repository"7git status --shortExpected result
1The first commit records README.md and .gitignore; the final status is empty because the working tree is clean.Line-by-line reading
| Line | Code | Explanation |
|---|---|---|
| 1 | mkdir professional-repository && cd professional-repository | Implements the next bash statement in the example's data flow. |
| 2 | git init | Implements the next bash statement in the example's data flow. |
| 3 | printf '# Professional Repository Starter\n' > README.md | Emits the example's observable output. |
| 4 | printf '.env\n.venv/\n__pycache__/\n' > .gitignore | Emits the example's observable output. |
| 5 | git add README.md .gitignore | Implements the next bash statement in the example's data flow. |
| 6 | git commit -m "chore: initialize reproducible repository" | Implements the next bash statement in the example's data flow. |
| 7 | git status --short | Implements the next bash statement in the example's data flow. |
Step-by-step execution
- The shell resolves the current directory and starts each command with arguments and environment.
- Git hashes file contents and stages the selected snapshot in the index.
- Commit creates an immutable tree and parent-linked history node.
- Push transfers missing objects; review and CI verify the proposed branch independently.
- Merge advances or combines history only after review evidence succeeds.
Common mistakes and professional corrections
| Area | Common failure | Better engineering choice |
|---|---|---|
| Terminal and filesystem | A script that assumes the caller's directory can read configuration from, or write output to, the wrong project. | Use project-relative paths for portable repository content and resolve an explicit base directory for automation that must not depend on where it was launched. |
| Git mental model | Using git add . without reviewing the staged diff can include secrets, generated files, or unrelated edits. | Inspect both unstaged and staged diffs, stage related changes, and make each commit buildable and explainable. |
| Repository quality | Instructions that depend on an author's global packages, hidden files, or unexplained manual steps fail precisely when another developer needs them. | Test README instructions in a clean environment and keep them beside the version of code they describe. |
Interview and review notes
- Define the central abstraction without naming a library function.
- Trace one request, call, query, message, render, or state transition from input to observable result.
- Compare two alternatives from this chapter by guarantee, cost, and failure behavior.
- Explain the most likely production bug and the test or metric that reveals it.
- State what remains authoritative after process loss, retry, reconnect, or deployment.
Practice set
Easy
- Define every bold term in the concept tables in one precise sentence.
- Reproduce the focused examples and annotate the value or state after each important line.
- Explain the chapter progression diagram aloud in two minutes.
Medium
- Replace one convenient default with an explicit policy for validation, timeout, ordering, pagination, cleanup, or error handling.
- Write a negative test for each topic group.
- Compare the measured behavior before and after one justified change.
Hard
- Combine all topic groups into one thin vertical slice.
- Inject a realistic failure at the most important external boundary and prove recovery.
- Write a one-page design note covering ownership, trade-offs, security, observability, and rollback.
Chapter submission
Submit:
- source code or reproducible commands;
- automated tests plus one deliberately failing-before-fix test;
- captured output, query plan, trace, screenshot, or metric;
- a 300–500 word explanation of the execution flow and one rejected alternative;
- a short README with setup, versions, limitations, and cleanup steps.
Self-review rubric
| Dimension | Beginning | Competent | Professional |
|---|---|---|---|
| Explanation | Names APIs | Explains behavior | Connects guarantees, internals, and trade-offs |
| Implementation | Happy path only | Validated and tested | Clear ownership, failure recovery, and cleanup |
| Evidence | Manual claim | Repeatable output | Tests plus meaningful measurement or inspection |
| Communication | Steps missing | Reproducible README | Decisions, limits, and alternatives are explicit |
Roadmap coverage checklist
- To do: Terminal and filesystem: absolute vs relative paths
- To do: Terminal and filesystem: files/directories and permissions
- To do: Terminal and filesystem: processes, environment variables and exit codes
- To do: Terminal and filesystem: pipes, redirection and command help
- To do: Git mental model: working tree, staging area and commit graph
- To do: Git mental model: branching, merging and rebasing
- To do: Git mental model: remote tracking and pull requests
- To do: Git mental model: restore, revert and conflict resolution
- To do: Repository quality: README and reproducible setup
- To do: Repository quality: .gitignore and secret hygiene
- To do: Repository quality: semantic commits and review size
- To do: Repository quality: basic CI verification
Quick revision
- Terminal and filesystem: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Git mental model: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Repository quality: connect the surface API to its guarantee, lifecycle, failure boundary, and evidence.
- Re-read the worked-example execution trace instead of memorizing isolated syntax.
- If you cannot name the owner of state and cleanup, the design is not yet complete.
Mastery check
How well can you recall this?
Finished this lesson?