Read Anthropic’s case study about Graphite Reviewer

The new standard for developer infrastructure

Graphite CLI

Streamline Git commands and seamlessly stack pull requests from your terminal.

See more

VS Code extension

Create and edit stacked PRs visually without leaving your IDE.

See more

Pull request inbox

Stay on top of every PR and review request in one unified inbox.

See more

Graphite Reviewer

Get immediate, actionable feedback on every pull request with Graphite's codebase-aware AI.

See more

Merge Queue

Eliminate merge conflicts and keep your main branch green—whether you're a team of 10 or 10,000.

See more

Insights and reports

Accelerate your team with powerful, real-time developer metrics.

See more
pr pagepr pagepr pagepr pagepr pagepr pagepr pagepr pagepr page

The Graphite CLI

A faster, more intuitive Git interface, designed to make stacking effortless

Start a stack

Create the first branch in your stack with gt create.

Keep stacking

Run gt create again to stack another branch on top of your previous changes without waiting for them to merge into main.

Visualize your stack

Get a bird's eye view of your stack with gt log.

Publish your stack

Create or update PRs for every branch in your stack with gt submit.

Respond to feedback

Update changes across your stack with gt modify. Graphite handles all of the recursive rebasing for you.

Ship, sync, repeat

Automatically sync your local stack with remote changes, and clean up stale branches with gt sync.

VS Code extension

Create and edit stacked PRs visually without leaving your IDELearn more
Graphite VS Code extension

Inbox zero for your code changes

Stay on top of every PR and review request in one unified inbox

Every change in one place

Stay on top of your team's pull requests from one dashboard. See reviews, CI status, stack info, and everything else you need to know about your PRs.

Fully customizable

Customize each inbox section to match your workflow. Filter PRs based on author, CI status, reviews, labels, and much, much more.

As fast as you are

Keyboard shortcuts, at-a-glance statuses, and real-time GitHub sync help you stay up-to-date and take action on things that need your attention.

Pull requests the way they should be

File diffs, version history, comments, and CI in one intuitive interface. Code review has never been this enjoyable.

Get started
pr inboxpr inboxpr inbox

Graphite Reviewer

Get immediate, actionable feedback on every pull request with Graphite's codebase-aware AI
42+export const updateBaseBranchIfNecessary = async ({
43+ pr,
44+ newMergeBase,
45+ actor,
46+ serverContext,
47+}: {
48+ pr: PrToRebase;
49+ newMergeBase: string;
50+ actor: GithubCachedActorWithHost;
51+ serverContext: TServerContext;
52+}) => {
53+ const { owner, repo, number } = pr;
54
55+ const skipUpdateBaseBranchIfUnchanged =
56+ await serverContext.clients.statsig.checkOrgBasedFlagDeprecated({
57+ configName: "skip_update_base_branch_if_unchanged",
58+ orgGithubLogins: [owner],
59+ splog: serverContext.splog,
60+ });
61
62+ if (skipUpdateBaseBranchIfUnchanged) {
63+ const freshPr =
64+ await serverContext.clients.githubCache.pullRequests.getFreshPrAndCache({
65+ githubClient,
66+ owner,
67+ repo,
68+ number,
69+ source: "REBASE_UPDATE_BASE_BRANCH",
70+ config: {
71+ await: true,
72+ },
73+ });
74
75+ if (freshPr && freshPr.baseRef.name === newMergeBase) {
76+ return;
77+ }
78+ }
79
80+ const sleepSeconds = await determineSleepTime({ owner, serverContext });
81+ await sleep({ seconds: sleepSeconds });
82
83+ serverContext.splog.verbose({
84+ message: `Updating PR base branch after rebase`,
85+ tags: { pr, newMergeBase },
86+ });
87
88+ await updatePrBase({
89+ owner,
90+ repo,
91+ prNumber: pr.number,
92+ base: newMergeBase,
93+ githubClient,
94+ context: serverContext,
95+ });
96+};
97
98+export async function rebasePullRequest({
99+ pr,
100+ actor,
101+ newMergeBase,
102+ stackJobId,
103+ gitClient,
104+ serverContext,
105+}: {
106+ pr: PrToRebase;
107+ actor: GithubCachedActorWithHost;
108+ newMergeBase: string;
109+ stackJobId: string;
110+ gitClient: GitClient;
111+ serverContext: TServerContext;
112+}): Promise<RebaseResult> {
113+ const rebaseStartTime = DateTime.now();
114+ const rebaseResult = await gitClient.rebaseUnmergedRange({
115+ headBranch: pr.headBranch,
116+ trunkBranch: newMergeBase,
117+ });
118
119+ const durationMs = startTime
120+ .diff(DateTime.now())
121+ .as("milliseconds");
122
123+ serverContext.splog.verbose({
124+ message: `Rebase completed in ${rebaseDurationMs}ms`,
125+ tags: {
126+ rebaseDurationMs,
127+ pr,
128+ newMergeBase,
129+ },
130+ });
131
132+ if (rebaseResult !== "SUCCESS") {
133+ serverContext.splog.warn({
134+ message: `Failed to rebase ${pr.owner}/${pr.repo}#${pr.number}`,
135+ tags: {
136+ pr,
137+ newMergeBase,
138+ rebaseResult,
139+ },
140+ });
141+ return { result: rebaseResult };
142+ }
Graphite ReviewerSparkle
Graphite Reviewerjust now
The calculation of durationMs is incorrect. It's currently calculating the duration from the current time to the start time, which will result in a negative duration. To fix this, swap the order of the arguments in the diff() method: DateTime.now().diff(startTime)
Spotted byGraphite Reviewer
Is this helpful?
👍
👎

Instant feedback

Graphite Reviewer automatically scans opened PRs for bugs, logical errors, and other technical pitfalls so reviewers can focus on the big picture.

Codebase awareness

Graphite Reviewer uses RAG (Retrieval-Augmented Generation) on your team's past pull requests to ensure that every piece of feedback makes sense in the context of your codebase.

Custom rules

Coming soon

Define and enforce custom patterns with AI prompts and regex.

Graphite Insights

In-depth historical metrics that actually matter

Beyond vanity

Visualize and track data-driven metrics that are proven to enhance developer productivity.

Transparency

Graphite Insights empowers every member of your team with data—regardless of their role.

A historical record

Graphite Insights measures developer trends over time, allowing you to identify and fix bottlenecks in your engineering workflow.

Learn more
insightsinsightsinsightsinsightsinsightsinsightsinsightsinsights

Code change infrastructure

Eliminate merge conflicts and keep your main branch green—whether you're a team of 10 or 10,000

Keep changes flowing

Graphite Merge Queue puts your merge process on autopilot, keeping your engineers unblocked.

Merge from anywhere

Merge PRs from Graphite, GitHub, or even your terminal.

Save money and CI time

Powerful CI optimizations skip redundant tests, saving you time and money.

Book a demo
merge queuemerge queuemerge queuemerge queue

Built for the world's fastest engineering teams, now available for everyone