惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
GRAHAM CLULEY
T
Tenable Blog
Know Your Adversary
Know Your Adversary
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Privacy International News Feed
S
Security Affairs
NISL@THU
NISL@THU
O
OpenAI News
Attack and Defense Labs
Attack and Defense Labs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hacker News: Ask HN
Hacker News: Ask HN
Webroot Blog
Webroot Blog
Schneier on Security
Schneier on Security
S
SegmentFault 最新的问题
S
Schneier on Security
G
Google Developers Blog
V
V2EX
C
Check Point Blog
U
Unit 42
Google DeepMind News
Google DeepMind News
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
T
The Exploit Database - CXSecurity.com
Recent Announcements
Recent Announcements
M
MIT News - Artificial intelligence
S
Secure Thoughts
博客园 - 司徒正美
Recorded Future
Recorded Future
P
Proofpoint News Feed
Spread Privacy
Spread Privacy
K
Kaspersky official blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
AI
AI
博客园 - 聂微东
N
News and Events Feed by Topic
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
Vulnerabilities – Threatpost
P
Palo Alto Networks Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Engineering at Meta
Engineering at Meta
Recent Commits to openclaw:main
Recent Commits to openclaw:main
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
The Hacker News
The Hacker News
The Last Watchdog
The Last Watchdog
Project Zero
Project Zero
W
WeLiveSecurity
博客园 - Franky

Butler's Log

Agentic Version Control Benchmarks Grit: rewriting Git in Rust with agents Git Merge 2026 Agent-safe Git with GitButler We’ve raised $17M to build what comes after Git Announcing the GitButler CLI for Linux The Great CSS Expansion A couple of git nits Simplifying Git by Using GitButler Introducing the GitButler CLI GitButler 0.19 - "Commander Keen" But Head: Crafting a Custom Font MCP vs RAG: Two Very Different Ways to Gain Context Getting Started With GitButler Agents Using the GitButler MCP Server to Build Better AI-Driven Git Workflows Using GitButler With Multiple GitHub Accounts Advent of Code! Upcoming GitButler Events Use GitButler for your Gerrit workflow Integrating GitButler and GitHub Enterprise Butler Flow: shipping code faster (but less like Alfred, more like CI on steroids) - Part 3 Butler Flow: shipping code faster (but less like Alfred, more like CI on steroids) - Part 2 Butler Flow: shipping code faster (but less like Alfred, more like CI on steroids) - Part 1 Grid Happens: Because Flexbox Wasn’t Enough Deep Dive into the new Cursor Hooks A Responsive Item Counter with CSS only GitButler 0.16 - "Sweet Sixteen" GitButler's Claude Code tab GitButler's Annual Open Source Pledge Report Git Mini Summit 2025 Videos Automate Your AI Workflows with Claude Code Hooks Managing Multiple Claude Code Sessions Without Worktrees GitButler 0.15 - "Quirky Quinceañera" 20 years of Git. Still weird, still wonderful. GitButler's new patch based Code Review (Beta) Going down the rabbit hole of Git's new bundle-uri How to do patch-based review with git range-diff How Core Git Developers Configure Git Why is Git Autocorrect too fast for Formula One drivers? Stacked Branches with GitButler Git Merge 2024 Talks are Up GitButler 0.13 - "Lucky Baseball" Fearless Rebasing Git Merge 2024 Why GitHub Actually Won GitButler is joining the Open Source Pledge The New Era of Town Hall Chat The Future of Open Source GitButler is now Fair Source Git Merge 2024 GitButler 0.12 - "Stingy Baker" The Birth of THE MERGE GitButler for Windows Fixing up Git with Autosquash The Git Zeitgeist Git Worktrees and GitButler DevWorld Git Slides Git Tips and Tricks Git Tips 1: Oldies but Goodies Git Tips 2: New Stuff in Git Git Tips 3: Really Large Repositories FOSDEM Git Talk Opening Up GitButler Debugging Tauri in VS Code Advent of GitButler Code Signing Commits in Git, Explained Virtual Branches Alpha Our We Are Developers Adventure Building Virtual Branches DevDays in Vilnius The Future of Software and Open Source Introducing GitButler
Using Cursor Hooks for automatic version control
Scott Chacon · 2025-09-24 · via Butler's Log

Today's release of Cursor 1.7 introduces a new lifecycle hooks feature, which makes it easy to use GitButler to automatically write smart commits and create new branches from your Cursor chats in the background.

Introduction to using GitButler with Cursor Hooks

One of the nice things about the GitHub Mafia is that there are helpful Hubbers everywhere.

After we made the Claude Code hooks integration, I reached out to some amazing ex-Hubbers at Anysphere to see if they could help us with a way to more easily see what Cursor was doing when it worked, so we could build some tools to help automate the version control of it's work.

At the time, they were working on writing temporary Git commits into a hidden ref as the agent worked as a sort of snapshotting system and we thought we could tie into that. However, after some issues turned up, they moved on to pursuing a hooks system instead.

Happily, they invited us to try out the new system as it was being built in the nightlies, so we got to give early feedback and hopefully help improve the API and documentation. This is how we're able to provide our hooks compatibility on the first day.

There are a few challenges that I think we've all faced when using agentic coding systems, expecially around version control.

If you do setup some sort of Git subagent, MCP server or ruleset, you have to wait for it to run every time and you simply end up with one big stack of commits. So most developers just wait and do the committing by hand, which means you probably mix up work or lose context. Or best case, have to switch context when the agentic task is done.

It's much nicer (and much, much faster) to have this done automatically and have the commits aware of the agentic context prompt when crafting the commit message.

Cursor hooks are read from a hooks.json file, either in your project's .cursor directory, or your user's global ~/.cursor directory if you want the hooks to run for all your projects. (There is also an enterprise directory at /etc/cursor/hooks.json but I assume that's rarely used?)

You need to install the GitButler CLI from either brew install gitbutler or through your GitButler settings.

That gives you the but command line tool, which is what you need to setup as your hooks. Your hooks file would then look like this:

JSON

{
  "version": 1,
  "hooks": {
    "afterFileEdit": [
      {
        "command": "but cursor after-edit"
      }
    ],
    "stop": [
      {
        "command": "but cursor stop"
      }
    ]
  }
}

We make use of the afterFileEdit hook to mark files that Cursor has modified and assign them to a branch, then commit and write a message on the stop hook.

Now every new chat you do will automatically be put in a new branch and every time the task is completed, a new commit will be made based off your prompt. You can always easily squash down commits later, but now you have a nice starting point and a reminder of what your prompt history was.

The other nice thing is that creating a new chat automatically makes a new branch in parallel, meaning it's easier to have it start work on a new thing and easily split that out into an independent PR.

Check out our video intro or docs to learn more about how cool it is to use Cursor with GitButler in the background automatically handling everything.

I'm glad you asked!

We learned a lot about hooks while reviewing the functionality and developing the integration, so we wrote up a deep dive article if you're interested in how hooks work and what else you can currently do with them.

The Cursor hooks integration is available in the latest GitButler release's CLI. If you have questions or feedback, join us in our Discord community - we'd love to hear about your experience!

Scott Chacon

Written by Scott Chacon

Scott Chacon is a co-founder of GitHub and GitButler, where he builds innovative tools for modern version control. He has authored Pro Git and spoken globally on Git and software collaboration.