1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-12-01 22:52:01 +02:00

set upstream to origin branchname on push

This commit is contained in:
Jesse Duffield
2018-08-05 18:19:27 +10:00
parent 67e56e5fbc
commit 8aacd6915b

View File

@@ -13,6 +13,11 @@ import (
"github.com/fatih/color"
)
var (
// ErrNoCheckedOutBranch : When we have no checked out branch
ErrNoCheckedOutBranch = errors.New("No currently checked out branch")
)
// GitFile : A staged/unstaged file
// TODO: decide whether to give all of these the Git prefix
type GitFile struct {
@@ -446,7 +451,11 @@ func gitPull() (string, error) {
}
func gitPush() (string, error) {
return runDirectCommand("git push -u")
branchName := gitCurrentBranchName()
if branchName == "" {
return "", ErrNoCheckedOutBranch
}
return runDirectCommand("git push -u origin " + branchName)
}
func gitSquashPreviousTwoCommits(message string) (string, error) {