Git-branchless stacked diffs workflow patterns and command reference
60
66%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./plugins/git-workflow/skills/branchless-workflow/SKILL.mdGit-branchless enables stacked diffs development - working with multiple commits that build on each other, editing any commit in the stack, and managing PRs efficiently.
In git-branchless, you work in detached HEAD mode. Main stays put while you stack commits above it.
# Always detach before building a stack
git checkout --detach
# Or use git record -d to auto-detach
git record -d -m "feat: first commit"| Icon | Meaning |
|---|---|
◆ | Public commit (on main branch) |
◯ | Draft commit (your work in progress) |
● | Current HEAD position |
✕ | Abandoned/hidden commit |
ᐅ | Current branch indicator |
git sl # View commit stack (smartlog)git prev # Move to parent commit
git next # Move to child commit
git prev N # Jump N commits up
git next N # Jump N commits down
git sw -i # Interactive commit selector (fuzzy finder)
git sw -i <search> # Pre-filter by search termgit record -m "msg" # Commit all changes (no git add needed)
git record -c pr/name -m "msg" # Commit + create branch in one step
git record -d -m "msg" # Detach from branch, then commit
git record -I -m "msg" # Insert commit in middle, auto-rebase childrengit amend # Amend current commit + auto-restack descendants
git reword # Change commit message + auto-restack
git restack # Rebase descendants onto amended commitgit move -s <src> -d <dst> # Move commit(s) to new parentgit sync # Rebase stack onto local main
git sync --pull # Fetch remote + rebase stackgit switch -c pr/name # Create branch at current commit
git submit -c @ # Push current branch to remote (first time)
git submit # Force-push existing branches (update PRs)git hide <hash> # Hide commit from smartlog
git unhide <hash> # Restore hidden commitgit undo # Undo last operation (with confirmation)
git undo -i # Interactive undo — browse historygit checkout --detach
git record -m "feat: first feature"
git record -m "feat: second feature"
git record -m "feat: third feature"
git sl # View your stackgit prev 2 # Go to the commit to fix
# make changes...
git add . && git amend # Amend + restack descendants
git next 2 # Return to top# For each commit, create branch and submit
git prev 2
git switch -c pr/first-feature
git submit -c @
git next
git switch -c pr/second-feature
git submit -c @
git next
git switch -c pr/third-feature
git submit -c @For true stacked PRs on GitHub:
| PR | Base Branch |
|---|---|
| pr/first-feature | main |
| pr/second-feature | pr/first-feature |
| pr/third-feature | pr/second-feature |
git pull origin main
git sl # Find merge commit hash
git move -s <next-commit> -d <merge-commit-hash>
# Recreate branches for remaining commits
git switch -c pr/remaining-feature
git submit -c @git sync --pull # Fetch + rebase stack
git submit # Update all PRsgit undo -i # Browse history, find good state, restoregit rebase -i mainIn the editor:
pick — keep commit as-isdrop — remove commitfixup — squash into previous (discard message)squash — squash into previous (combine messages)git checkout --detach or git record -dgit amend instead of git commit --amend - It auto-restacks descendantsgit record instead of git add + git commit - Simpler workflowgit restack after manual amends - Fixes abandoned commitsgit sync --pull regularly - Keep stack updated with maingit switch -c or git record -cgit submit - Updates all stacked PRs at oncegit restack # Rebase descendants onto amended commitYou committed on main. Fix:
git checkout --detach
git branch -f main <initial-commit-hash>You need a branch AND --create:
git switch -c pr/my-feature
git submit -c @Move remaining commits onto merge commit:
git pull origin main
git sl # Find merge commit hash
git move -s <next-commit> -d <merge-commit-hash># Resolve conflicts in files
git add <resolved-files>
git rebase --continue0ebe7ae
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.