Mastering Git and GitHub in 2026: A Developer's Essential Toolkit
By Huzi
File #298 · 4 min read
You know commit, push, and how to apologize in a pull request. Mastery is the next layer: keeping history linear before anyone reviews it, recovering from the mistakes that feel fatal, and leaving reviews that make code better instead of longer. None of it is hard. All of it is habit.
The quick answer: Master Git by rebasing onto the fresh main before you ask for review, trusting the reflog when work "disappears", and force-pushing with --force-with-lease instead of force. Good reviews name one thing you actually verified, and the gh CLI closes the loop without a browser. All habit, no heroics.
Rebase before you ask for review
Your branch started from Monday's main; it is Thursday now, and main moved. Rebasing replays your commits on top of the fresh tip, so reviewers see your change once, cleanly, instead of a merge-conflict museum:
git fetch origin
git rebase origin/main
Conflicts pause the replay; resolve each one, then continue. Two rules keep you safe: rebase is local hygiene — never rewrite a branch other people have already pulled — and if you must force-push, --force-with-lease fails politely instead of overwriting someone's new commits.
The reflog: almost nothing is truly lost
The day will come when a botched rebase or a panicky git reset --hard makes your work "disappear". Breathe. Git remembers every place HEAD has pointed:
git reflog
# a1b2c3d HEAD@{7}: rebase (abort) ...
# e4f5a6b HEAD@{8}: commit: feat: payment retries
git reset --hard HEAD@{8}
Find the moment before the disaster, reset to it or branch from it, and your work is back. Deleted branches, amended commits, most "I lost everything" moments — the reflog has been keeping receipts the whole time.
| Move | What it does | When to reach for it |
|---|---|---|
git rebase origin/main |
Replays your commits on the fresh tip | Before asking for review |
--force-with-lease |
Fails politely instead of overwriting new commits | When you must force-push |
git reflog |
Remembers every place HEAD has pointed | After a botched rebase or reset |
gh pr merge --squash --delete-branch |
Merges with the branch cleaned up | Closing a colleague's PR |
| Signed commits (SSH key or gitsign) | Proves who wrote what | At this level, always |
Reviews worth reading
Three habits upgrade a team's review culture fast. Review your own PR first, top to bottom — you will catch the leftover debug lines and save reviewers for real questions.
Comment on the why, never the what: "uses a five-minute cache because the upstream API rate-limits" is context; "this fetches the user" is noise.
And retire the bare LGTM — an approval should name one thing you actually verified, or it is a rubber stamp wearing a signature. When two engineers fundamentally disagree, do not let it fester for a week: one short call, decision documented in the thread, move on.
There is a passport-shaped cousin to this discipline. A visa file is really a branch awaiting review — every change logged, every document checked before it ships — and HTG Travels runs exactly that kind of desk from Sialkot.
Close the loop from the terminal
gh pr checkout 432
gh pr merge --squash --delete-branch
gh run watch
gh release create v1.42.0 --generate-notes
Check out a colleague's PR locally, merge it squashed with the branch cleaned up, watch CI from the terminal, and cut a release with generated notes. Signed commits — an SSH key, or Sigstore's keyless gitsign — are worth switching on while you are at this level.
Pro tip: Small commits are your reflog insurance — the less that changed, the easier it is to find the moment before the disaster.
Git's whole design whispers that history can be recovered — the families of Gaza deserve a reflog of their own, a way back to what was taken.
When something you thought was settled gets refused — a UK or Schengen visa file, say — we do the reflog thing for a living. HTG Travels reworks refused cases from Sialkot, finds what actually sank them, and re-files properly. Start with one line to +92 317 5054959 when the deploy can wait and the mountains cannot.




