Lesson 5: Put it together — a tiny workflow
Lesson objectives:
- Combine init, commit, branch, and recovery in a single project.
- Follow a safe order of operations.
- Explain what to do when something goes wrong.
Prerequisites: Lessons 01-04 (commits, history and recovery, branches and merging) | Previous << 04 | Next: course complete
A day in the life
You now have the pieces. This lesson shows a complete workflow you can use for any small project: a short story, a set of notes, a design file, a recipe collection, or early code.
The workflow:
- Create a folder and run
git init. - Make your first commit on
main. - Start a branch when you want to experiment.
- Switch back to
mainwhen you need the stable version. - Merge the experiment when it works.
- Use
git logandgit restoreif you need to recover something.
Worked example (follow along)
Create a new folder for a tiny project.
Your turn (faded example)
Here is the workflow with two blanks. Fill them in.
Answer:
Common mistake breakdown
Mistake: Forgetting to commit before switching branches. If you have uncommitted changes, git switch may refuse to move or may carry changes you did not expect. Fix: commit your work first, or run git status to see what Git is about to do.
Summary + what's next
You can now initialize a repository, commit your work, branch, and recover a previous version of a file — all in your own terminal. That is the heart of Git.
The next step is to use it on a real project. Pick one folder you edit often and run git init there. Make your first commit today.