Advanced Git: rebase & stash
This course works through rebase and stash using this app's Git history and a disposable scratch repository. It shows a rebase that stops on a conflict and a commit that disappears when its patch becomes empty. It covers git commit --fixup with git rebase --autosquash, including the Git 2.44 change, and git rebase --onto for moving a branch to a new base. The stash lessons cover git stash push, list and show, the difference between apply and pop, untracked files with -u, and conflicts during stash pop.
What you'll learn
- ✓Resolving a rebase conflict with git add and git rebase --continue, plus --abort and --skip
- ✓Why a rebase drops a commit whose diff becomes empty
- ✓Folding fixup commits with git commit --fixup and git rebase --autosquash
- ✓Moving a branch to a different base with git rebase --onto
- ✓Storing and reading uncommitted work with git stash push, list and show
- ✓Choosing between stash apply and pop, and handling a stash pop conflict
This app's Git history so far
Both commands ran against this project when this course was revised. These six commits are the work itself: lesson rewrites and one small app fix. What --no-merges hides is how they reached main. Each arrived through a pull request, and main records that with a merge commit ("Merge pull request…
Read the full lesson free →Curriculum
7 lessonsThis app's Git history so far
Reads this app's Git log and branch list, showing merge commits, stacked branches and branches not yet in main.
Rebase replays one commit at a time, shown with a conflict
A rebase stops on a conflict, is resolved step by step, and silently drops a commit whose diff empties.
Autosquash: the part of interactive rebase you can run headless
Uses git commit --fixup with git rebase --autosquash, which runs without an editor since Git 2.44.
rebase --onto: moving a branch to a new base
Explains git rebase --onto with examples from Git's manual and a stacked-branch case after a squash-merge.
git stash: a second stack for uncommitted work
Shows git stash push, list and show, and how stash entries live in refs/stash outside any branch.
apply keeps, pop drops: the difference
Compares git stash apply, which keeps the entry, with pop, which drops it, and covers -u for untracked files.
When stash pop conflicts, and rebase or merge in practice
Shows a stash pop conflict that keeps the entry, git stash branch, and where stash fits beside rebase and merge.