Master interactive rebase, bisect, worktrees, and other advanced Git features that separate beginners from experts.
February 25, 2026 · 9 min · 1834 words · Rob Washington
Table of Contents
You know git add, commit, push, and pull. That gets you through 90% of daily work. But the remaining 10%—untangling merge conflicts, finding bug introductions, managing multiple branches simultaneously—requires deeper knowledge.
Find exactly which commit introduced a bug using binary search.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Start bisectinggit bisect start
# Mark current commit as badgit bisect bad
# Mark known good commitgit bisect good v1.0.0
# Git checks out middle commit. Test it, then:git bisect good # if bug not presentgit bisect bad # if bug present# Repeat until Git finds the culprit# When done:git bisect reset
Work on multiple branches simultaneously without stashing or cloning.
1
2
3
4
5
6
7
8
9
10
11
# Create worktree for a branchgit worktree add ../myproject-feature feature-branch
# Create worktree with new branchgit worktree add -b hotfix ../myproject-hotfix main
# List worktreesgit worktree list
# Remove worktreegit worktree remove ../myproject-feature
Use cases:
Review PR while working on your own feature
Run tests on one branch while developing on another
# Basic stashgit stash
# Stash with messagegit stash push -m "WIP: feature work"# Stash including untracked filesgit stash -u
# Stash including ignored filesgit stash -a
# List stashesgit stash list
# Apply most recent stash (keep in list)git stash apply
# Apply and remove from listgit stash pop
# Apply specific stashgit stash apply stash@{2}# Show stash contentsgit stash show -p stash@{0}# Create branch from stashgit stash branch new-branch stash@{0}# Drop specific stashgit stash drop stash@{0}# Clear all stashesgit stash clear
# Last commitgit commit --amend --author="Name <email@example.com>"# Multiple commits (interactive rebase + edit)git rebase -i HEAD~5
# Mark commits as 'edit', then for each:git commit --amend --author="Name <email>"git rebase --continue
# Hooks live in .git/hooks/ls .git/hooks/
# Example: pre-commit hookcat > .git/hooks/pre-commit << 'EOF'
#!/bin/bash
# Run tests before commit
npm test
if [ $? -ne 0 ]; then
echo "Tests failed, commit aborted"
exit 1
fi
EOFchmod +x .git/hooks/pre-commit
These tools transform Git from a simple backup system into a powerful history manipulation toolkit. Interactive rebase alone will change how you think about commits.
Start with git reflog—knowing your safety net exists makes experimentation less scary. Then practice interactive rebase on a throwaway branch until it feels natural.
The goal isn’t to memorize commands. It’s to know what’s possible so you can look up the syntax when you need it.
📬 Get the Newsletter
Weekly insights on DevOps, automation, and CLI mastery. No spam, unsubscribe anytime.