feat(mq): add gt mq integration create command
Implement 'gt mq integration create <epic>' command to create integration branches for batch work on epics. The command: 1. Verifies the epic exists in beads 2. Creates branch integration/<epic-id> from origin/main 3. Pushes the branch to origin 4. Stores integration branch info in the epic's metadata Also adds helper methods to git package: - CreateBranchFrom: create branch from specific ref - BranchExists: check if local branch exists - RemoteBranchExists: check if branch exists on remote Future MRs for the epic's children can target the integration branch with: gt mq submit --epic <epic-id> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -314,6 +314,39 @@ func (g *Git) CreateBranch(name string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// CreateBranchFrom creates a new branch from a specific ref.
|
||||
func (g *Git) CreateBranchFrom(name, ref string) error {
|
||||
_, err := g.run("branch", name, ref)
|
||||
return err
|
||||
}
|
||||
|
||||
// BranchExists checks if a branch exists locally.
|
||||
func (g *Git) BranchExists(name string) (bool, error) {
|
||||
_, err := g.run("show-ref", "--verify", "--quiet", "refs/heads/"+name)
|
||||
if err != nil {
|
||||
// Exit code 1 means branch doesn't exist
|
||||
if strings.Contains(err.Error(), "exit status 1") {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// RemoteBranchExists checks if a branch exists on the remote.
|
||||
func (g *Git) RemoteBranchExists(remote, branch string) (bool, error) {
|
||||
_, err := g.run("ls-remote", "--heads", remote, branch)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
// ls-remote returns empty if branch doesn't exist, need to check output
|
||||
out, err := g.run("ls-remote", "--heads", remote, branch)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return out != "", nil
|
||||
}
|
||||
|
||||
// DeleteBranch deletes a branch.
|
||||
func (g *Git) DeleteBranch(name string, force bool) error {
|
||||
flag := "-d"
|
||||
|
||||
Reference in New Issue
Block a user