# Cursor Git Panel Pushing to main even when branch is checked out

**URL:** <https://forum.cursor.com/t/cursor-git-panel-pushing-to-main-even-when-branch-is-checked-out/159788>\
**Category:** Bug Reports\
**Tags:** worktrees\
**Created:** [May 5, 2026, 1:33pm UTC](https://forum.cursor.com/t/cursor-git-panel-pushing-to-main-even-when-branch-is-checked-out/159788 "2026-05-05T13:33:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yohai\_Wiener](https://avatars.discourse-cdn.com/v4/letter/y/c67d28/32.png) [@Yohai\_Wiener](https://forum.cursor.com/u/Yohai_Wiener)\
**Post date:** [May 5, 2026, 1:33pm UTC](https://forum.cursor.com/t/cursor-git-panel-pushing-to-main-even-when-branch-is-checked-out/159788/1 "2026-05-05T13:33:20Z")

</div>

### Where does the bug appear (feature/product)?

Cursor IDE

### Describe the Bug

The cursor IDE’s git panel’s sync button was pushing directly to main even though I was checked out on a branch.

### Steps to Reproduce

I am not sure how to reproduce this but I was in a git worktree if that helps.

### Expected Behavior

I expect that the sync button would never perform actions on a different branch than what is checked out.

### Screenshots / Screen Recordings

 ![Screenshot 2026-05-05 at 16.32.04.png](https://us1.discourse-cdn.com/cursor1/original/3X/d/e/de816f43ddef9bae4c9cc2b0fc34bc040fd35f66.jpeg)

### Operating System

MacOS

### Version Information

Version: 3.2.21 (Universal)  
VSCode Version: 1.105.1  
Commit: 806df57ed3b6f1ee0175140d38039a38574ec720  
Date: 2026-05-03T01:46:14.413Z  
Layout: editor  
Build Type: Stable  
Release Track: Default  
Electron: 39.8.1  
Chromium: 142.0.7444.265  
Node.js: 22.22.1  
V8: 14.2.231.22-electron.0  
OS: Darwin arm64 25.3.0

### Does this stop you from using Cursor

No - Cursor works, but with this issue

---

<div class="post-metadata">

**Author:** ![mohitjain](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/mohitjain/32/100229_2.png) [@mohitjain](https://forum.cursor.com/u/mohitjain)\
**Post date:** [May 6, 2026, 7:11am UTC](https://forum.cursor.com/t/cursor-git-panel-pushing-to-main-even-when-branch-is-checked-out/159788/7 "2026-05-06T07:11:52Z")

</div>

This is a known bug with git worktrees. Our team is tracking the issue. No fix has shipped yet, but a couple of things you can do in the meantime:

1. Use the terminal for push/pull when working in worktrees — `git push origin HEAD` will always target the correct branch

2. Check the Sync tooltip before clicking (as you caught in your screenshot) — if it says `origin/main` when you’re on a feature branch, fall back to the terminal

Thanks for the screenshot showing the mismatch between the commit input and Sync target — that’s helpful evidence.

---

<div class="post-metadata">

**Author:** ![mohitjain](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/mohitjain/32/100229_2.png) [@mohitjain](https://forum.cursor.com/u/mohitjain)\
**Post date:** [May 28, 2026, 2:33pm UTC](https://forum.cursor.com/t/cursor-git-panel-pushing-to-main-even-when-branch-is-checked-out/159788/9 "2026-05-28T14:33:59Z")

</div>

Hey @Yohai_Wiener,  
Just checking in — are you still seeing the git sync button pushing to main instead of your checked-out branch? We’ve shipped updates to worktree handling since this was reported. If you’re still hitting it on the latest version, a fresh report with your current Cursor version would help us investigate.
