How to Resume Claude Code Sessions from a GitHub Pull Request
Problem
When I use Claude Code to create pull requests, I hit a frustrating workflow issue. A few days later, reviewers leave feedback. I want to address their comments, but I’ve already closed that Claude session. When I start a new session, I have to re-explain everything:
User: "I need to fix the auth module based on review feedback. Here's what I built...[10 minutes of re-explaining the architecture]...the reviewer wants error handling added to the login function."
Claude: "Got it. I'll add error handling to the login function."This context-switching overhead wastes time on every review cycle. I found myself spending more time re-explaining than actually implementing fixes.
What I discovered
I came across a Reddit discussion titled “10 Claude Code features most developers aren’t using” and found this comment:
“I had no idea about the
--from-prflag. Well done, internet friend!!”
Wait, there’s a flag for this? I checked the Trigger.dev article mentioned in the thread and discovered that Claude Code automatically links sessions to pull requests it creates. The --from-pr flag retrieves that stored session.
This feature exists but most developers don’t know about it.
How to use it
The syntax is straightforward. You can reference a PR by number (if you’re in the repo) or by full URL:
# If you're in the repo, just use the PR numberclaude --from-pr 447# Works with any PR URLclaude --from-pr https://github.com/acme/awesome-app/pull/447When I tried this, Claude immediately remembered everything from the original session: the architectural decisions, the code I wrote, and even the reasoning behind specific choices.
Here’s a typical workflow:
# Step 1: Create PR with Claudeclaude> Create a pull request for the new caching feature
# Claude creates PR #892 and links the session
# ... days pass, reviewer leaves feedback ...
# Step 2: Resume sessionclaude --from-pr 892> The reviewer wants me to add error handling to the auth module.> Can you update the code based on their comments?
# Claude makes the changes with full context
# Step 3: Push updatesgit push# PR updates, session remains linkedThe session persists across multiple review iterations. I can keep coming back with --from-pr 892 and Claude remembers the entire conversation history.
Why this works
Claude Code doesn’t just create pull requests—it stores metadata that links the PR to the session ID. When you use --from-pr, it:
- Retrieves the session ID associated with that PR
- Rehydrates the full agent state from storage
- Restores conversation history and code context
This transforms Claude from a single-session tool into a persistent PR companion. The feedback loop compresses from “re-explain context + implement” to just “implement.”
Common mistakes
I made a few mistakes learning this feature:
Mistake 1: Creating PRs manually
# If you create PR with git CLI, Claude can't link the sessiongit checkout -b feature/authgit push -u origin feature/authgh pr create --title "Add auth" --body "..."
# Later...claude --from-pr 123# ERROR: No linked session foundThe session linking only works when Claude creates the PR. If you create PRs manually with gh pr create, there’s no session to resume.
Mistake 2: Using different Claude instances
I tried resuming a PR session on a different machine. Since session storage is local, the --from-pr flag couldn’t find the linked session. You need to use the same machine where you created the PR.
Mistake 3: Assuming indefinite storage
Sessions don’t last forever. After a few weeks, Claude may not be able to retrieve older sessions. I learned this when I tried to resume a PR from two months ago.
When to use this
This feature shines in iterative review workflows:
- Multi-round code reviews: Each round of feedback can be addressed without context loss
- Team handoffs: If a teammate needs to continue your work, they can resume your session
- Complex features: Large PRs with architectural context benefit most from preserved reasoning chains
- Time-separated work: Address feedback days later without refreshing your own memory
Related knowledge
Session management in AI tools
Most AI coding assistants don’t handle session persistence well. They treat each conversation as isolated. Claude Code’s approach of linking sessions to external artifacts (PRs) is relatively unique.
Other tools handle this differently:
- GitHub Copilot: No persistent sessions, context limited to open files
- Cursor: Has composer sessions but no PR linking
- Aider: Uses git history but doesn’t link to PRs specifically
The mental model shift
I think this feature represents a shift in how to think about AI coding assistants:
AI = Single-use tool (start session, get help, close session)
New modelAI = Persistent collaborator (create artifact, link session, resume anytime)When sessions link to work artifacts, the AI becomes part of the development history rather than a disposable helper.
Combining with other Claude Code features
The --from-pr flag works well with other advanced features:
# Resume PR sessionclaude --from-pr 447
# In the resumed session, use compact mode for large PRs> /compact # Condenses context to fit more discussion
# Or use plan mode for complex changes> /plan> The reviewer wants error handling. Let's plan the approach.Summary
In this post, I showed how to use Claude Code’s --from-pr flag to resume sessions linked to GitHub pull requests. The key point is that Claude automatically stores session IDs when it creates PRs, and you can retrieve those sessions with claude --from-pr <number>.
This feature eliminates the context-switching overhead that plagued my review workflows. Instead of spending 10 minutes re-explaining architecture to a new session, I can jump straight into implementing feedback.
The feature is underutilized—as evidenced by the surprised Reddit comment—but it transforms Claude Code from a disposable helper into a persistent PR collaborator.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
- 👨💻 Trigger.dev: 10 Claude Code Tips You Didn't Know
- 👨💻 Reddit: 10 Claude Code Features Most Developers Aren't Using
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments