git: Add option to branch from default branch in branch picker (#34663)

Closes #33700

The option shows up as an icon that appears on entries that would create
a new branch. You can also branch from the default by secondary
confirming, which the icon has a tooltip for as well.

We based the default branch on the results from this command: `git
symbolic-ref refs/remotes/upstream/HEAD` and fallback to `git
symbolic-ref refs/remotes/origin/HEAD`

Release Notes:

- Add option to create a branch from a default branch in git branch
picker

---------

Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
Anthony Eid 2025-08-04 14:08:00 -04:00 committed by GitHub
parent fa8dd1c547
commit 9fa634f02f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 133 additions and 9 deletions

View file

@ -10,7 +10,7 @@ use git::{
},
status::{FileStatus, GitStatus, StatusCode, TrackedStatus, UnmergedStatus},
};
use gpui::{AsyncApp, BackgroundExecutor};
use gpui::{AsyncApp, BackgroundExecutor, SharedString};
use ignore::gitignore::GitignoreBuilder;
use rope::Rope;
use smol::future::FutureExt as _;
@ -491,4 +491,8 @@ impl GitRepository for FakeGitRepository {
) -> BoxFuture<'_, Result<String>> {
unimplemented!()
}
fn default_branch(&self) -> BoxFuture<'_, Result<Option<SharedString>>> {
unimplemented!()
}
}