How to change the default branch for Cursor

In my work repository, we use development as the “main” branch. When using the @ menu to select the “Branch (Diff with Main)” option, it’s not clear to me which branch is actually being used as the base for comparison.

How do I ensure that Cursor is choosing the correct base branch for this context setting?

1 Like

Related Customize @Git Diff Base Branch

It seems vscode has an existing concept of this in the setting git.defaultBranchName. Maybe Cursor could use this if it’s set to customize the diffing behavior?

Hey @quantizor

For your awareness, this is how Cursor is determining what the main branch is for Branch (Diff with Main)

  1. git symbolic-ref --short refs/remotes/origin/HEAD. This is the primary method. It reads what branch the remote’s origin/HEAD points to.

  2. If the above fails, it checks for main, master, then develop in that order.

  3. If none of the common names exist, it uses the first origin/* branch.

  4. Git config — As a last resort, it checks git config --get init.defaultBranch

If git symbolic-ref --short refs/remotes/origin/HEAD points to development, you should be good to go.

1 Like

Thanks Colin, that was super helpful! If I could suggest moving 4 up above 2 I think that would be the most obvious experience. Basically just makes it so intentional user config always wins.

1 Like