Learn how to build, test, deploy, and maintain robust software systems.
In a professional team, Git is more than saving snapshots of your code. It is the coordination layer that lets many developers work on the same codebase safely: branches isolate work, pull requests enable review, and advanced commands like interactive rebase and git bisect keep history clean and help you find bugs. This lesson assumes you know the basics — init, add, commit, push. It focuses on the workflows and tools that professional engineers actually use: branching strategies, clean commit history, conflict resolution, hooks, and debugging with bisect. The goal is not to memorise commands but to understand the mental model behind them, so you can choose the right approach when your team’s repository gets complicated.
Changes move forward through four areas. Understanding this explains nearly every Git command.
A branch is a movable pointer to a commit. HEAD is a pointer to the branch you are currently on. When you commit, the branch pointer moves forward; HEAD stays attached to it.
| GitFlow | Trunk-Based Development | |
|---|---|---|
| Branches | Long-lived develop + feature + release branches | Short-lived feature branches merged to main |
| Release | Dedicated release branches | Continuous releases from main |
| Overhead | Higher | Lower |
| Best for | Scheduled, multi-version releases | Fast, continuous delivery |
A pull request is a proposal to merge one branch into another. It creates a place for review, discussion, automated checks, and final approval before the merge.
Interactive rebase rewrites a branch’s commit history before it is merged, so the final history is clean. Squashing combines several small commits into one logical commit.
Hooks are scripts Git runs automatically at certain events. A pre-commit hook can run a linter or formatter; a pre-push hook can run tests before code leaves your machine.
When a bug was introduced at some unknown commit, git bisect performs a binary search over the history to find the first bad commit.
| git revert | git reset | |
|---|---|---|
| What it does | Adds a new commit that undoes a change | Moves the branch pointer backward |
| History | Preserved | Rewritten |
| Safe on shared branches? | Yes | No |
The reflog records where HEAD has been, so you can often recover "lost" commits. Tags mark specific commits (for example, a release) with a stable name.
git bisect checks out a middle commit; you mark it good or bad and it narrows down to the first bad commit.
Combine three work-in-progress commits into one clean commit.
History becomes: one squashed commit
Binary-search the history to isolate the bad commit.
Bisecting: 6 revisions left to test