diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-13 22:14:57 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-13 22:25:42 +1100 |
commit | 3b1d705473494cca9894ec051d9d928c0c8926c7 (patch) | |
tree | 8e6661248e5ab7aced0aee0f68995bb1f57ee398 /pkg/commands/git.go | |
parent | f43ba728e3206b354d8cb66470fa2a42300c01a8 (diff) |
show upstream branch for branch
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r-- | pkg/commands/git.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 145b188fe..ad275d10f 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -530,6 +530,11 @@ func (c *GitCommand) GetBranchGraph(branchName string) (string, error) { return c.OSCommand.RunCommandWithOutput(fmt.Sprintf("git log --graph --color --abbrev-commit --decorate --date=relative --pretty=medium -100 %s", branchName)) } +func (c *GitCommand) GetUpstreamForBranch(branchName string) (string, error) { + output, err := c.OSCommand.RunCommandWithOutput(fmt.Sprintf("git rev-parse --abbrev-ref --symbolic-full-name %s@{u}", branchName)) + return strings.TrimSpace(output), err +} + // Ignore adds a file to the gitignore for the repo func (c *GitCommand) Ignore(filename string) error { return c.OSCommand.AppendLineToFile(".gitignore", filename) |