Capstone: A Full Git Workflow
This lesson joins the whole course into one session. A new project, a branch, a merge, and a tag, in order.
Start the project
A fresh folder becomes a repository, and the first snapshot saves the plan.
$ git init
$ git add plan.txt
$ git commit -m "Start the weekend plan"Branch and merge
The Sunday work grows on its own branch, then joins main.
$ git switch -c add-sunday
$ git add plan.txt
$ git commit -m "Add Sunday park"
$ git switch main
$ git merge add-sundayFinish with a tag
The branch is gone. The history holds two snapshots and one tag.
$ git branch -d add-sunday
$ git log --oneline --graph
$ git tag v1.0
$ git statusExample
$ git log --oneline --graph
$ git tag v1.0
$ git statusKey points
- Start with init, then a first snapshot.
- Branch for the new idea.
- Merge the branch back when it works.
- Tag the finished state.
- Every step here ran in a real terminal.
- The next project is yours. The steps are the same.
Here, the finished project holds two snapshots and one tag. The tree is clean. The work is done.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
What is the first step of the workflow?