跳到正文
日常 Git 操作暂存

暂存整个文件, 或单个代码块

“本地更改”会展示你修改过的内容,清晰区分为已暂存和未暂存两部分,并在一旁显示差异对比。

立即体验

AgentWorking1 agent · 2 subagents
Branchfeature/checkout-v2↑2 not pushed
Pull request#214 Checkout v2: shipping and payment as separate steps#214 open · mira
Checks CIe3b7a10 · 2/3
Preview deployment Ready28 min ago · 2 commentsstorefront-git-feature-checkout-v2.northpier.dev
Local Changes
Unstaged 4
app
checkout
payment
shipping
docs
lib
cart
Staged 1
app
checkout
app/checkout/payment/page.tsx
@@ -12,9 +12,12 @@ export default async function PaymentPage()
1212 const cart = await getCart();
1313 const address = await savedAddress(cart.customerId);
14- if (!address) redirect("/checkout");
14+ if (!address) redirect("/checkout/shipping");
15+
16+ const methods = await paymentMethods(cart.region);
1517
1618 return (
17- <PaymentForm cart={cart} />
19+ <PaymentForm cart={cart} address={address} methods={methods} />
1820 );
@@ -31,6 +34,7 @@ export const metadata
3134 export const metadata = {
3235 title: "Payment",
36+ robots: { index: false },
3337 };

试试看

  1. 点击一个文件查看它的差异对比。

  2. 点击差异块上方的 暂存代码块,只暂存那一部分更改。

  3. 点击 全部暂存,输入提交信息,然后点击 提交已暂存更改。

  4. 使用过滤框旁的按钮在树状视图和平铺列表之间切换。

  • 上方未暂存,下方已暂存

    两个列表完全契合 git 的工作方式。选中一个或多个文件,通过“暂存”或“取消暂存”在两栏间移动。

  • 一次一个代码块

    点击差异中的某个区块,只暂存该代码块,让每次提交都专注于单一改动。

  • 树状或平铺列表

    按文件夹层级查看变更文件,或切换为纯路径列表,并支持按名称过滤。每个文件都标有已修改、新增、删除、重命名或冲突状态。

  • 不会丢失的提交信息

    如果你写了一半提交信息后关闭了标签页、窗口或整个应用,回来时它依然完好无损。每个工作树都有独立的草稿。

  • 每个文件都有菜单

    可以直接打开文件、用其他应用打开、在访达中显示、放弃更改、查看历史记录或复制路径。

  • 贮藏

    附带说明将当前更改暂存到一旁。之后在侧边栏选中该贮藏即可查看内容并应用。

Questions, *answered*

Can I stage only part of a file?
Yes. Click in a block of the diff and Stage hunk stages only that part, so one commit holds one idea.
Do I lose my commit message if I close the window?
No. If you start a commit message and close the tab, the window or the app, it is still there when you come back. There is a draft for each worktree.

继续探索

全部功能

下载 gitā

免费。支持 macOS 14 或更高版本,兼容 Apple silicon 与 Intel。