Foundations: Linux, scripting, Git & networking
Git
Git is the foundation of every DevOps workflow: CI pipelines trigger on it, GitOps treats it as the source of truth, and code review, releases and audit trails all live in it. Senior interviews go beyond add/commit/push: they ask how Git stores data, merge vs rebase and when each is dangerous, how to recover from mistakes (a force-push, a leaked secret, a bad merge on main), which branching strategy suits continuous delivery, and how to run repositories at scale in CI.
After this topic you can
- Branch, commit, merge and rebase with confidence
- Recover from mistakes such as a bad force-push
- Set up branch protection and a clean pull-request workflow
Lessons
-
1How Git stores data
- Snapshots, not diffs
- The object database
- References: branches, HEAD and tags
- The three areas
-
2Everyday workflow and investigating history
- Core commands
- git bisect — find the commit that broke something
- git reflog — your safety net
-
3Merging and rebasing
- Merge
- Rebase
- Interactive rebase: clean up before review
- Merge strategies on pull requests
- Resolving conflicts
-
4Undoing things safely
- Pick the right tool
- Force pushes
- A secret was committed
-
5Remotes and team collaboration
- Remotes, fetch, pull and push
- Pull requests and code review
- Forks vs branches
-
6Branching strategies
- Trunk-based development
- GitFlow
- GitHub flow
- Release branches
- Environment branches: an anti-pattern in GitOps
- Versioning and releases
-
7Repositories at scale and in CI
- Monorepo vs polyrepo
- Making Git fast in CI
- Large files, submodules and hooks
- Git hosting for DevOps
-
8Interview questions and model answers
- "Merge vs rebase — which do you use?"
- "How do you undo a bad commit that's already pushed to main?"
- "What's the difference between reset --soft, --mixed and --hard?"
- "Someone committed an AWS key to the repo. What do you do?"
- "Trunk-based development or GitFlow?"
- "How would you find which commit introduced a bug?"
- "Your CI uses shallow clones and versioning from tags broke. Why?"
- "How do you structure a GitOps config repo for multiple environments?"