Git module
Lesson 2
init, status, diff
Create a repository and see untracked, modified, and staged states.
beginner25 minRun on your machine
What you will be able to do
- git init a new project directory
- Read git status for untracked files
- Use git diff after edits
Why this matters for data work
status and diff are how you review your own change before anyone else sees it — the same habit as checking a query before shipping.
Concepts
git init— creates.git/- Untracked — new file Git does not watch yet
- Modified — tracked file changed
git diff— unstaged changes;git diff --staged— staged
Practice on your machine
mkdir -p ~/dcubes/git-lab/init-demo
cd ~/dcubes/git-lab/init-demo
git init
git branch -M main
git status
cat > README.md << 'EOF'
# init-demo
Practice repo for DCubes Git.
EOF
git status
You should see README.md as untracked.
echo "line two" >> README.md
# still untracked — diff may be empty until first add
git add README.md
git status
echo "line three" >> README.md
git diff
What you should see
.gitdirectory after init.- status moves from untracked → staged after
add. git diffshows the unstaged “line three” change.
Common mistakes
git initinside home by accident — init only project folders.- Ignoring status and committing junk.