Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

feat: Sort branches by committer date

Maximilian Roos98f1589ce803
diff --git a/src/git/repository/mod.rs b/src/git/repository/mod.rs
index 42ff21908..3e9663be1 100644
--- a/src/git/repository/mod.rs
+++ b/src/git/repository/mod.rs
@@ -773,7 +773,11 @@ impl Repository {
/// Get all branch names (local branches only).
pub fn all_branches(&self) -> Result<Vec<String>, GitError> {
- let stdout = self.run_command(&["branch", "--format=%(refname:short)"])?;
+ let stdout = self.run_command(&[
+ "branch",
+ "--sort=-committerdate",
+ "--format=%(refname:short)",
+ ])?;
Ok(stdout
.lines()
.map(|s| s.trim())