Tooling and Wrap-up
Last updated on 2026-11-02 | Edit this page
Overview
Questions
- What small things make these habits quicker?
- Which VS Code features match what we did in the terminal?
- What should I take away and try on Monday?
Objectives
- Create useful git aliases, and know a few settings worth turning on
- Match the commands from the workshop to VS Code’s source control features
- Pick one habit to adopt first
Make the good habits quicker
This episode is a menu, not a to-do list. Skim it, or read it after the workshop. Everything here is a personal choice.
An alias is a nickname for a git command. Plenty of people use none at all, and typing the full command is perfectly fine. These are some of the ones that are commonly shared, if you’d like a few:
BASH
git config --global alias.st "status -sb"
git config --global alias.lg "log --oneline --graph --decorate"
git config --global alias.unstage "restore --staged"
git config --global alias.last "log -1 --stat"
| Type | It runs | You’d use it to |
|---|---|---|
git st |
git status -sb |
a short status, with the branch |
git lg |
git log --oneline --graph --decorate |
see the history as a picture |
git unstage <file> |
git restore --staged <file> |
take a file out of the next commit |
git last |
git log -1 --stat |
see what the last commit changed |
They’re stored in your ~/.gitconfig file. Change them,
add your own, and delete the ones you don’t use. (VS Code covers a lot
of this already, so you may not need any.)
A word on settings
Git’s defaults are the defaults for good reasons, and a lot of the
advice about settings online is one person’s preference. Change
a setting when you’ve hit the problem it solves, not before.
The three we asked you to set in the setup (pull.rebase,
rebase.autoSquash and push.autoSetupRemote)
suit the workflow in this workshop, but they are preferences too, and
many people never change them.
If you want to try something, these three are widely recommended and low-risk:
| Setting | What it does |
|---|---|
fetch.prune true |
removes your copies of branches that were deleted on GitHub, so your branch list stays tidy |
rebase.autoStash true |
stashes uncommitted changes before a rebase, and puts them back afterwards |
merge.conflictStyle zdiff3 |
conflict markers also show the original version, which makes conflicts easier to understand (needs Git 2.35 or newer) |
Set one with
git config --global <setting> <value>, and undo
it with git config --global --unset <setting>.
VS Code and the terminal
We used both. This table matches what we did to what VS Code offers, so you can use whichever you prefer.
| What we did | In VS Code |
|---|---|
| Stage part of a file (ep 5) | In the diff editor, select lines and use the gutter Stage button, or right-click Stage Selected Ranges |
| Unstage, or discard changes | the - icon, or right-click Discard Changes |
| Amend the last commit (ep 5) | the dropdown on the Commit button, then Commit (Amend) |
| Undo the last commit (ep 5) |
..., then Commit,
then Undo Last Commit
|
| Read your branch like a reviewer (ep 7) | the Source Control Graph: select a commit, then a file |
| History of one file (ep 10) | the Timeline view in the Explorer |
| Blame (ep 10) | Git: Toggle Git Blame Editor Decoration in the Command Palette |
| Compare with a branch or tag | right-click a commit in the graph, then Compare with… (or Compare with Merge Base) |
| Resolve a conflict (ep 9) | Resolve in Merge Editor, then Complete Merge |
| Stash and restore | Git: Stash, Git: Pop Latest Stash in the Command Palette |
| Cherry-pick (ep 13) | right-click a commit in the graph, then Cherry Pick |
| Give up on a merge, rebase or cherry-pick | Git: Abort Merge / Abort Rebase / Abort Cherry Pick |
And the things that have no button, so you use the
terminal: --fixup commits, interactive
rebase and --autosquash, the
reflog, bisect,
range-diff, and --force-with-lease. (The
GitLens extension adds an editor for interactive rebase
and more, if you want a graphical version of those.)
Things we only mentioned
Stash. Real work gets interrupted. You’re halfway through an edit, and a colleague asks you to look at something on another branch. You can’t switch branches with half-finished changes in the way, and you don’t want to make a messy commit. Stash puts your uncommitted changes in a drawer and gives you a clean working directory:
BASH
git stash push -m "README scratch note" # put them away, with a label
git stash list # what's in the drawer?
git switch main # do the other thing...
git switch my-feature # ...and come back
git stash pop # take the changes out again
OUTPUT
Saved working directory and index state On my-feature: README scratch note
stash@{0}: On my-feature: README scratch note
Some variations: git stash push -u also stashes new,
untracked files, git stash apply is like pop
but keeps the stash in the drawer, and git stash drop
throws one away. In VS Code, run Git: Stash (it asks
for an optional message) and Git: Pop Latest Stash from
the Command Palette. Git: Stash Staged stashes
only what’s staged, which is
git stash push --staged and needs Git 2.35 or newer.
Worktrees. Sometimes you want two branches checked out at once, such as a release branch for a quick fix while your feature is in the middle of a change. Instead of stashing and switching, make a second folder for the same repository:
You get a new folder with release/0.2 checked out. Work
there, commit, and delete it when you’re finished
(git worktree remove ../peakfinder-hotfix). VS Code can
manage worktrees too.
The merge base. The merge base of two
branches is the commit where they diverged:
git merge-base main my-feature. It’s what
git range-diff and VS Code’s Compare with Merge
Base compare against.
Take-aways
Nobody does all of this at once. Here are the habits we’ve covered, roughly in order of how much they give back:
- Plan the change, then the commits.
- Make commits atomic, with messages that say why.
- Use fixup for mistakes in earlier commits, and autosquash before you share.
-
Rebase onto
mainrather than mergingmaininto your branch. Push with--force-with-lease. - Review your own branch first, then ask for review.
- Let CI check what a person shouldn’t have to.
Challenge: your first step
- If you like, add an alias or two from the list above, and try them
in your
peakfinderclone. (Or skip this: it’s optional.) - Decide one habit from the take-aways that you’ll try on your own work next week. Tell your partner, and say what might get in the way.
Keep it small. One habit that you actually use is worth more than six that you don’t.
There’s no single answer. A popular first choice is fixup and autosquash, because you can start with it today, on any branch, without anyone else changing what they do.
If you’re not sure, try this on your next piece of work: write the
commit plan first, make each commit one idea, and run
git lg before you ask for review to check that it reads
like a story.
Where next
- Pro Git, the free book, at git-scm.com/book. Chapters 3 (branching), 7 (tools) and 10 (internals) go deeper on everything here.
- Learn Git Branching, an interactive game that draws the graphs as you type: learngitbranching.js.org.
- Conventional Commits, if you want a commit message convention: conventionalcommits.org.
- The reference page in this lesson has a cheat sheet of the commands and a glossary.
- The extras page has a short guided peek
inside
.git(blobs, trees and packfiles), and reading on how git works, on branching models such as git flow, and on the topics in this workshop.
Thank you
We’d love to hear what worked and what didn’t.
- Aliases and settings are personal choices: git’s defaults are fine, and you only need to change what’s bothering you
- VS Code covers staging, amending, history, blame, conflicts, stash
and cherry-pick. Fixup, interactive rebase, the reflog, bisect and
range-diffneed the terminal - Pick one habit to adopt first. Atomic commits and fixup with autosquash give the most for the least effort