Git module
Lesson 3
add, commit, log
Stage snapshots, write commit messages, and read history.
beginner30 minRun on your machine
What you will be able to do
- Stage files with git add
- Create commits with clear messages
- Read history with git log
Why this matters for data work
A commit is a snapshot you can name in a PR or incident review. Messages like “fix” waste everyone’s time; “add revenue_by_store.sql” does not.
Concepts
- Staging area — what the next commit will include
git commit -m "message"git log --oneline— compact history- Commits need a configured user.name / email (Getting Started)
Practice on your machine
cd ~/dcubes/git-lab/init-demo
git add README.md
git commit -m "Add README for init-demo"
git log --oneline
cat > hello.txt << 'EOF'
hello git
EOF
git add hello.txt
git commit -m "Add hello.txt"
git log --oneline
What you should see
- Two commits on
main(or your default branch). - Clean
git status(“nothing to commit”).
Common mistakes
- Huge unrelated commits — split by idea.
- Secrets in a commit — rotate the secret; history rewrite is advanced (avoid for now).