Linux, terminal and Git

Stage 5 · Lesson 2 of 8

Working tree, staging area and commits

Git fundamentals

keeps your work in three places. The is your files as they are on disk. The staging area, also called the index, is what the next commit will contain.

The is the you have already committed. git status shows what has changed and what is staged. git add moves changes into the staging area.

git diff shows changes you have not staged yet, and git diff --staged shows what you are about to commit. git add -p lets you stage only part of a file, so you can split unrelated changes into separate commits. git log --oneline --graph draws the history.

Common trapgit add . followed by a commit without reading the , which is how secrets and debug code get committed.

A question to check yourself, an AI practice session and 2 cheat sheet entries come when you add the roadmap to your account. Add it

Resources for this stage

Start with· follow one of these

  • BookFree
    Pro Git

    Scott Chacon and Ben Straub

    The free official Git book; chapters 2 and 3 cover everything in this stage properly

  • CourseFree
    The Missing Semester of Your CS Education

    MIT · Beginner

    The version control lecture teaches Git from its data model upwards, which makes commands make sense

Practise

Keep handy

Also worth your time

Mark this stage as not done?