Foundations: web, servers, containersLesson 12 of 13
From Branch to Merge Request
Every CI/CD flow starts from one change (a commit) recorded in a Git repository. Follow how changes from two developers working at the same time go through review, get merged into the main line, and get a release version label.
Where A worksmain
Merge requestNone
main statusHealthy
RequestResponse / reportAppears in a later step
What you will learn
- Local vs remote repository
- What one commit contains
- What merge requests and code review do
- Why conflicts happen and who resolves them
- Git tags vs image tags
Terms and hands-on
| Term | Meaning in one line | How to check |
|---|---|---|
| Commit hash | A unique string for each commit | git log --oneline shows the 7-character short hash and message |
| Branch | A split-off line of work | Create with git switch -c feature/login, list with git branch |
| Merge request | A request to merge, plus the review record | GitLab calls it a merge request, GitHub a pull request. Preview the diff with git diff main |
| Conflict | The same line changed in different ways | Not an error. Find conflicted files with git status, fix them by hand, then commit |
| Tag | A label on a commit | Add with git tag v1.2.0. Not the same as an image tag |
If you put the commit hash or Git tag in the image tag, you can trace which code an image running in the cluster came from. See the running image in the Image field of kubectl describe deployment <name>.
Try it yourself
git log --oneline --graph --all -n 20 # Commits, branches and merges
git branch -a # Local and remote branches
git show --stat HEAD # One commit: hash, author, message, files
git diff main...<branch> # What the merge request would show
git tag -n # Release tags
Check yourself
Further reading: Pro Git · GitLab merge requests · GitHub pull requests