fix: remove hardcoded branch names from push/pull operations

- Remove hardcoded "main" branch from git push and pull commands
- Let Git automatically detect and use current branch
- Add comprehensive tests for different branch names (main, master, develop)
- Fixes GitHub issue #14 where operations failed on repos using "master"
This commit is contained in:
Yar Kravtsov
2025-08-01 06:43:39 +03:00
parent 9bf2e70d13
commit dc524607fa
2 changed files with 121 additions and 2 deletions

View File

@@ -437,7 +437,7 @@ func (g *Git) Push() error {
return &PushError{Reason: err.Error(), Err: err}
}
cmd := exec.Command("git", "push", "-u", "origin", "main")
cmd := exec.Command("git", "push", "-u", "origin")
cmd.Dir = g.repoPath
output, err := cmd.CombinedOutput()
@@ -456,7 +456,7 @@ func (g *Git) Pull() error {
return &PullError{Reason: err.Error(), Err: err}
}
cmd := exec.Command("git", "pull", "origin", "main")
cmd := exec.Command("git", "pull", "origin")
cmd.Dir = g.repoPath
output, err := cmd.CombinedOutput()