When returning to a project with incomplete work in remote branches, a systematic approach helps assess and decide how to proceed with each branch.
# List all branches
git branch -a
# Find unmerged branches
git branch --no-merged main
# Recent branch activity
git for-each-ref --sort=-committerdate refs/remotes/origin --format='%(committerdate:short) %(refname:short) %(subject)'
# Check specific branch differences
git log main..origin/branch-name --oneline
git diff main...origin/branch-name --statWhen: Work is partially complete but needs visibility
gh pr create --draft --base main --head branch-name --title "WIP: Description"Benefits:
- Documents intent and approach
- Allows collaboration
- Preserves context
- Shows in PR list for tracking
When: Work is experimental or very incomplete
git checkout branch-name
git pull origin branch-name
# Option A: Continue directly
# Option B: Stash current state first
git stash push -m "Previous WIP attempt"When: Commits need reorganization before review
git checkout branch-name
git rebase -i main
# Clean up commit historyWhen: Some ideas are good but implementation needs restart
# Cherry-pick specific commits
git cherry-pick commit-hash
# Or create patches
git format-patch main..branch-name-
Use Git Worktrees for isolated testing:
git worktree add ../project-wip branch-name
-
Document Intent:
- Check commit messages for TODOs
- Look for related issues
- Add comments to draft PRs
-
Test Before Deciding:
poetry install poetry run pytest poetry run flake8
-
Communicate Status:
- Update PR descriptions
- Close stale branches
- Document decisions
-
First understand what's broken:
- Run tests to see failures
- Check linting errors
- Try running the application
-
Decide on approach:
- Fix and continue if close to working
- Extract concepts if fundamentally flawed
- Archive with explanation if obsolete
-
Clean up before merging:
- Squash WIP commits
- Write proper commit messages
- Ensure all tests pass
- Active: Currently being developed
- Draft PR: Under review/discussion
- Stale: No activity >30 days
- Archived: Kept for reference but not active
Regular cleanup prevents accumulation of dead branches while preserving useful experimental work.