1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

added git pull and checkout commands

This commit is contained in:
Wilq
2018-06-02 16:52:29 +02:00
parent c51d6bdecf
commit 66c14a666d
2 changed files with 85 additions and 0 deletions

View File

@@ -69,6 +69,19 @@ func (repo *GitRepo) repository() string {
return str
}
func (repo *GitRepo) pull() string {
arg := []string{repo.gitDir(), repo.workTree(), "pull"}
cmd := exec.Command("git", arg...)
str := wtf.ExecuteCommand(cmd)
return str
}
func (repo *GitRepo) checkout(branch string) string {
arg := []string{repo.gitDir(), repo.workTree(), "checkout", branch}
cmd := exec.Command("git", arg...)
str := wtf.ExecuteCommand(cmd)
return str
}
func (repo *GitRepo) gitDir() string {
return fmt.Sprintf("--git-dir=%s/.git", repo.Path)