diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md
index bfa52b249..f37326fe4 100644
--- a/docs/keybindings/Keybindings_en.md
+++ b/docs/keybindings/Keybindings_en.md
@@ -59,6 +59,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
f: fast-forward this branch from its upstream
g: view reset options
R: rename branch
+ u: set/unset upstream
enter: view commits
diff --git a/docs/keybindings/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md
index 032a4b437..0fb4c8bb8 100644
--- a/docs/keybindings/Keybindings_nl.md
+++ b/docs/keybindings/Keybindings_nl.md
@@ -86,6 +86,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
f: fast-forward deze branch vanaf zijn upstream
g: bekijk reset opties
R: hernoem branch
+ u: set/unset upstream
enter: bekijk commits
diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md
index d36e580ca..b2e7eff11 100644
--- a/docs/keybindings/Keybindings_pl.md
+++ b/docs/keybindings/Keybindings_pl.md
@@ -59,6 +59,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
f: fast-forward this branch from its upstream
g: wyświetl opcje resetu
R: rename branch
+ u: set/unset upstream
enter: view commits
diff --git a/docs/keybindings/Keybindings_zh.md b/docs/keybindings/Keybindings_zh.md
index 719a12180..2393e9b49 100644
--- a/docs/keybindings/Keybindings_zh.md
+++ b/docs/keybindings/Keybindings_zh.md
@@ -74,6 +74,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
f: 从上游快进此分支
g: 查看重置选项
R: 重命名分支
+ u: set/unset upstream
enter: 查看提交
diff --git a/pkg/commands/git_commands/branch.go b/pkg/commands/git_commands/branch.go
index fd6994e01..acf40a7bd 100644
--- a/pkg/commands/git_commands/branch.go
+++ b/pkg/commands/git_commands/branch.go
@@ -109,6 +109,10 @@ func (self *BranchCommands) SetUpstream(remoteName string, remoteBranchName stri
return self.cmd.New(fmt.Sprintf("git branch --set-upstream-to=%s/%s %s", self.cmd.Quote(remoteName), self.cmd.Quote(remoteBranchName), self.cmd.Quote(branchName))).Run()
}
+func (self *BranchCommands) UnsetUpstream(branchName string) error {
+ return self.cmd.New(fmt.Sprintf("git branch --unset-upstream %s", self.cmd.Quote(branchName))).Run()
+}
+
func (self *BranchCommands) GetCurrentBranchUpstreamDifferenceCount() (string, string) {
return self.GetCommitDifferences("HEAD", "HEAD@{u}")
}
diff --git a/pkg/gui/controllers.go b/pkg/gui/controllers.go
index 4987210c9..2c851739d 100644
--- a/pkg/gui/controllers.go
+++ b/pkg/gui/controllers.go
@@ -23,12 +23,13 @@ func (gui *Gui) resetControllers() {
)
rebaseHelper := helpers.NewMergeAndRebaseHelper(helperCommon, gui.State.Contexts, gui.git, gui.takeOverMergeConflictScrolling, refsHelper)
+ suggestionsHelper := helpers.NewSuggestionsHelper(helperCommon, model, gui.refreshSuggestions)
gui.helpers = &helpers.Helpers{
Refs: refsHelper,
Host: helpers.NewHostHelper(helperCommon, gui.git),
PatchBuilding: helpers.NewPatchBuildingHelper(helperCommon, gui.git),
Bisect: helpers.NewBisectHelper(helperCommon, gui.git),
- Suggestions: helpers.NewSuggestionsHelper(helperCommon, model, gui.refreshSuggestions),
+ Suggestions: suggestionsHelper,
Files: helpers.NewFilesHelper(helperCommon, gui.git, osCommand),
WorkingTree: helpers.NewWorkingTreeHelper(helperCommon, gui.git, model),
Tags: helpers.NewTagsHelper(helperCommon, gui.git),
@@ -41,6 +42,7 @@ func (gui *Gui) resetControllers() {
func() *cherrypicking.CherryPicking { return gui.State.Modes.CherryPicking },
rebaseHelper,
),
+ Upstream: helpers.NewUpstreamHelper(helperCommon, model, suggestionsHelper.GetRemoteBranchesSuggestionsFunc),
}
gui.CustomCommandsClient = custom_commands.NewClient(
@@ -64,7 +66,6 @@ func (gui *Gui) resetControllers() {
syncController := controllers.NewSyncController(
common,
- gui.getSuggestedRemote,
)
submodulesController := controllers.NewSubmodulesController(
diff --git a/pkg/gui/controllers/branches_controller.go b/pkg/gui/controllers/branches_controller.go
index 2caa30525..096082ac4 100644
--- a/pkg/gui/controllers/branches_controller.go
+++ b/pkg/gui/controllers/branches_controller.go
@@ -97,9 +97,68 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty
Handler: self.checkSelectedAndReal(self.rename),
Description: self.c.Tr.LcRenameBranch,
},
+ {
+ Key: opts.GetKey(opts.Config.Branches.SetUpstream),
+ Handler: self.checkSelected(self.setUpstream),
+ Description: self.c.Tr.LcSetUnsetUpstream,
+ OpensMenu: true,
+ },
}
}
+func (self *BranchesController) setUpstream(selectedBranch *models.Branch) error {
+ return self.c.Menu(types.CreateMenuOptions{
+ Title: self.c.Tr.Actions.SetUnsetUpstream,
+ Items: []*types.MenuItem{
+ {
+ DisplayStrings: []string{self.c.Tr.LcUnsetUpstream},
+ OnPress: func() error {
+ if err := self.git.Branch.UnsetUpstream(selectedBranch.Name); err != nil {
+ return self.c.Error(err)
+ }
+ if err := self.c.Refresh(types.RefreshOptions{
+ Mode: types.SYNC,
+ Scope: []types.RefreshableView{
+ types.BRANCHES,
+ types.COMMITS,
+ },
+ }); err != nil {
+ return self.c.Error(err)
+ }
+ return nil
+ },
+ Key: 'u',
+ },
+ {
+ DisplayStrings: []string{self.c.Tr.LcSetUpstream},
+ OnPress: func() error {
+ return self.helpers.Upstream.PromptForUpstreamWithoutInitialContent(selectedBranch, func(upstream string) error {
+ upstreamRemote, upstreamBranch, err := self.helpers.Upstream.ParseUpstream(upstream)
+ if err != nil {
+ return self.c.Error(err)
+ }
+
+ if err := self.git.Branch.SetUpstream(upstreamRemote, upstreamBranch, selectedBranch.Name); err != nil {
+ return self.c.Error(err)
+ }
+ if err := self.c.Refresh(types.RefreshOptions{
+ Mode: types.SYNC,
+ Scope: []types.RefreshableView{
+ types.BRANCHES,
+ types.COMMITS,
+ },
+ }); err != nil {
+ return self.c.Error(err)
+ }
+ return nil
+ })
+ },
+ Key: 's',
+ },
+ },
+ })
+}
+
func (self *BranchesController) Context() types.Context {
return self.context()
}
diff --git a/pkg/gui/controllers/helpers/helpers.go b/pkg/gui/controllers/helpers/helpers.go
index c45852e29..61fdedf46 100644
--- a/pkg/gui/controllers/helpers/helpers.go
+++ b/pkg/gui/controllers/helpers/helpers.go
@@ -12,6 +12,7 @@ type Helpers struct {
Host *HostHelper
PatchBuilding *PatchBuildingHelper
GPG *GpgHelper
+ Upstream *UpstreamHelper
}
func NewStubHelpers() *Helpers {
@@ -27,5 +28,6 @@ func NewStubHelpers() *Helpers {
Host: &HostHelper{},
PatchBuilding: &PatchBuildingHelper{},
GPG: &GpgHelper{},
+ Upstream: &UpstreamHelper{},
}
}
diff --git a/pkg/gui/controllers/helpers/upstream_helper.go b/pkg/gui/controllers/helpers/upstream_helper.go
new file mode 100644
index 000000000..a3ece704e
--- /dev/null
+++ b/pkg/gui/controllers/helpers/upstream_helper.go
@@ -0,0 +1,88 @@
+package helpers
+
+import (
+ "errors"
+ "strings"
+
+ "github.com/jesseduffield/lazygit/pkg/commands/models"
+ "github.com/jesseduffield/lazygit/pkg/gui/types"
+)
+
+type UpstreamHelper struct {
+ c *types.HelperCommon
+ model *types.Model
+
+ getRemoteBranchesSuggestionsFunc func(string) func(string) []*types.Suggestion
+}
+
+type IUpstreamHelper interface {
+ ParseUpstream(string) (string, string, error)
+ PromptForUpstreamWithInitialContent(*models.Branch, func(string) error) error
+ PromptForUpstreamWithoutInitialContent(*models.Branch, func(string) error) error
+ GetSuggestedRemote() string
+}
+
+var _ IUpstreamHelper = &UpstreamHelper{}
+
+func NewUpstreamHelper(
+ c *types.HelperCommon,
+ model *types.Model,
+ getRemoteBranchesSuggestionsFunc func(string) func(string) []*types.Suggestion,
+) *UpstreamHelper {
+ return &UpstreamHelper{
+ c: c,
+ model: model,
+ getRemoteBranchesSuggestionsFunc: getRemoteBranchesSuggestionsFunc,
+ }
+}
+
+func (self *UpstreamHelper) ParseUpstream(upstream string) (string, string, error) {
+ var upstreamBranch, upstreamRemote string
+ split := strings.Split(upstream, " ")
+ if len(split) != 2 {
+ return "", "", errors.New(self.c.Tr.InvalidUpstream)
+ }
+
+ upstreamRemote = split[0]
+ upstreamBranch = split[1]
+
+ return upstreamRemote, upstreamBranch, nil
+}
+
+func (self *UpstreamHelper) promptForUpstream(currentBranch *models.Branch, initialContent string, onConfirm func(string) error) error {
+ return self.c.Prompt(types.PromptOpts{
+ Title: self.c.Tr.EnterUpstream,
+ InitialContent: initialContent,
+ FindSuggestionsFunc: self.getRemoteBranchesSuggestionsFunc(" "),
+ HandleConfirm: onConfirm,
+ })
+}
+
+func (self *UpstreamHelper) PromptForUpstreamWithInitialContent(currentBranch *models.Branch, onConfirm func(string) error) error {
+ suggestedRemote := self.GetSuggestedRemote()
+ initialContent := suggestedRemote + " " + currentBranch.Name
+
+ return self.promptForUpstream(currentBranch, initialContent, onConfirm)
+}
+
+func (self *UpstreamHelper) PromptForUpstreamWithoutInitialContent(currentBranch *models.Branch, onConfirm func(string) error) error {
+ return self.promptForUpstream(currentBranch, "", onConfirm)
+}
+
+func (self *UpstreamHelper) GetSuggestedRemote() string {
+ return getSuggestedRemote(self.model.Remotes)
+}
+
+func getSuggestedRemote(remotes []*models.Remote) string {
+ if len(remotes) == 0 {
+ return "origin"
+ }
+
+ for _, remote := range remotes {
+ if remote.Name == "origin" {
+ return remote.Name
+ }
+ }
+
+ return remotes[0].Name
+}
diff --git a/pkg/gui/files_panel_test.go b/pkg/gui/controllers/helpers/upstream_helper_test.go
similarity index 97%
rename from pkg/gui/files_panel_test.go
rename to pkg/gui/controllers/helpers/upstream_helper_test.go
index 08d5d8838..ac7a6a8bf 100644
--- a/pkg/gui/files_panel_test.go
+++ b/pkg/gui/controllers/helpers/upstream_helper_test.go
@@ -1,4 +1,4 @@
-package gui
+package helpers
import (
"testing"
diff --git a/pkg/gui/controllers/remote_branches_controller.go b/pkg/gui/controllers/remote_branches_controller.go
index b75cf3b13..dcedde8c0 100644
--- a/pkg/gui/controllers/remote_branches_controller.go
+++ b/pkg/gui/controllers/remote_branches_controller.go
@@ -57,7 +57,7 @@ func (self *RemoteBranchesController) GetKeybindings(opts types.KeybindingsOpts)
{
Key: opts.GetKey(opts.Config.Branches.SetUpstream),
Handler: self.checkSelected(self.setAsUpstream),
- Description: self.c.Tr.LcSetUpstream,
+ Description: self.c.Tr.LcSetAsUpstream,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
diff --git a/pkg/gui/controllers/sync_controller.go b/pkg/gui/controllers/sync_controller.go
index 69663f32e..9eb4ae16a 100644
--- a/pkg/gui/controllers/sync_controller.go
+++ b/pkg/gui/controllers/sync_controller.go
@@ -1,7 +1,6 @@
package controllers
import (
- "errors"
"fmt"
"strings"
@@ -13,21 +12,16 @@ import (
type SyncController struct {
baseController
*controllerCommon
-
- getSuggestedRemote func() string
}
var _ types.IController = &SyncController{}
func NewSyncController(
common *controllerCommon,
- getSuggestedRemote func() string,
) *SyncController {
return &SyncController{
baseController: baseController{},
controllerCommon: common,
-
- getSuggestedRemote: getSuggestedRemote,
}
}
@@ -85,8 +79,8 @@ func (self *SyncController) push(currentBranch *models.Branch) error {
if self.git.Config.GetPushToCurrent() {
return self.pushAux(pushOpts{setUpstream: true})
} else {
- return self.promptForUpstream(currentBranch, func(upstream string) error {
- upstreamRemote, upstreamBranch, err := self.parseUpstream(upstream)
+ return self.helpers.Upstream.PromptForUpstreamWithInitialContent(currentBranch, func(upstream string) error {
+ upstreamRemote, upstreamBranch, err := self.helpers.Upstream.ParseUpstream(upstream)
if err != nil {
return self.c.Error(err)
}
@@ -106,7 +100,7 @@ func (self *SyncController) pull(currentBranch *models.Branch) error {
// if we have no upstream branch we need to set that first
if !currentBranch.IsTrackingRemote() {
- return self.promptForUpstream(currentBranch, func(upstream string) error {
+ return self.helpers.Upstream.PromptForUpstreamWithInitialContent(currentBranch, func(upstream string) error {
if err := self.setCurrentBranchUpstream(upstream); err != nil {
return self.c.Error(err)
}
@@ -119,7 +113,7 @@ func (self *SyncController) pull(currentBranch *models.Branch) error {
}
func (self *SyncController) setCurrentBranchUpstream(upstream string) error {
- upstreamRemote, upstreamBranch, err := self.parseUpstream(upstream)
+ upstreamRemote, upstreamBranch, err := self.helpers.Upstream.ParseUpstream(upstream)
if err != nil {
return err
}
@@ -136,30 +130,6 @@ func (self *SyncController) setCurrentBranchUpstream(upstream string) error {
return nil
}
-func (self *SyncController) parseUpstream(upstream string) (string, string, error) {
- var upstreamBranch, upstreamRemote string
- split := strings.Split(upstream, " ")
- if len(split) != 2 {
- return "", "", errors.New(self.c.Tr.InvalidUpstream)
- }
-
- upstreamRemote = split[0]
- upstreamBranch = split[1]
-
- return upstreamRemote, upstreamBranch, nil
-}
-
-func (self *SyncController) promptForUpstream(currentBranch *models.Branch, onConfirm func(string) error) error {
- suggestedRemote := self.getSuggestedRemote()
-
- return self.c.Prompt(types.PromptOpts{
- Title: self.c.Tr.EnterUpstream,
- InitialContent: suggestedRemote + " " + currentBranch.Name,
- FindSuggestionsFunc: self.helpers.Suggestions.GetRemoteBranchesSuggestionsFunc(" "),
- HandleConfirm: onConfirm,
- })
-}
-
type PullFilesOptions struct {
UpstreamRemote string
UpstreamBranch string
diff --git a/pkg/gui/misc.go b/pkg/gui/misc.go
deleted file mode 100644
index ecd5c9ae8..000000000
--- a/pkg/gui/misc.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package gui
-
-import "github.com/jesseduffield/lazygit/pkg/commands/models"
-
-// this file is to put things where it's not obvious where they belong while this refactor takes place
-
-func (gui *Gui) getSuggestedRemote() string {
- remotes := gui.State.Model.Remotes
-
- return getSuggestedRemote(remotes)
-}
-
-func getSuggestedRemote(remotes []*models.Remote) string {
- if len(remotes) == 0 {
- return "origin"
- }
-
- for _, remote := range remotes {
- if remote.Name == "origin" {
- return remote.Name
- }
- }
-
- return remotes[0].Name
-}
diff --git a/pkg/i18n/chinese.go b/pkg/i18n/chinese.go
index 3de60412e..4dc2f9761 100644
--- a/pkg/i18n/chinese.go
+++ b/pkg/i18n/chinese.go
@@ -311,6 +311,7 @@ func chineseTranslationSet() TranslationSet {
DeleteRemoteBranch: "删除远程分支",
DeleteRemoteBranchMessage: "您确定要删除远程分支吗?",
LcSetUpstream: "设置为检出分支的上游",
+ LcSetAsUpstream: "设置为检出分支的上游",
SetUpstreamTitle: "设置上游分支",
SetUpstreamMessage: "您确定要将 {{.checkedOut}} 的上游分支设置为 {{.selected}} 吗?",
LcEditRemote: "编辑远程仓库",
diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go
index a72a3b6f0..b8605b839 100644
--- a/pkg/i18n/dutch.go
+++ b/pkg/i18n/dutch.go
@@ -270,6 +270,7 @@ func dutchTranslationSet() TranslationSet {
DeleteRemoteBranch: "Verwijder Remote Branch",
DeleteRemoteBranchMessage: "Weet je zeker dat je deze remote branch wilt verwijderen",
LcSetUpstream: "stel in als upstream van uitgecheckte branch",
+ LcSetAsUpstream: "stel in als upstream van uitgecheckte branch",
SetUpstreamTitle: "Stel in als upstream branch",
SetUpstreamMessage: "Weet je zeker dat je de upstream branch van '{{.checkedOut}}' naar '{{.selected}}' wilt zetten",
LcEditRemote: "wijzig remote",
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index 9c50e9790..aa3de764b 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -305,7 +305,9 @@ type TranslationSet struct {
LcRemoveRemotePrompt string
DeleteRemoteBranch string
DeleteRemoteBranchMessage string
+ LcSetAsUpstream string
LcSetUpstream string
+ LcUnsetUpstream string
SetUpstreamTitle string
SetUpstreamMessage string
LcEditRemote string
@@ -338,6 +340,7 @@ type TranslationSet struct {
Panel string
Keybindings string
LcRenameBranch string
+ LcSetUnsetUpstream string
NewGitFlowBranchPrompt string
RenameBranchWarning string
LcOpenMenu string
@@ -507,6 +510,7 @@ type Actions struct {
Merge string
RebaseBranch string
RenameBranch string
+ SetUnsetUpstream string
CreateBranch string
FastForwardBranch string
CherryPick string
@@ -907,7 +911,9 @@ func EnglishTranslationSet() TranslationSet {
LcRemoveRemotePrompt: "Are you sure you want to remove remote",
DeleteRemoteBranch: "Delete Remote Branch",
DeleteRemoteBranchMessage: "Are you sure you want to delete remote branch",
- LcSetUpstream: "set as upstream of checked-out branch",
+ LcSetAsUpstream: "set as upstream of checked-out branch",
+ LcSetUpstream: "set upstream of selected branch",
+ LcUnsetUpstream: "unset upstream of selected branch",
SetUpstreamTitle: "Set upstream branch",
SetUpstreamMessage: "Are you sure you want to set the upstream branch of '{{.checkedOut}}' to '{{.selected}}'",
LcEditRemote: "edit remote",
@@ -940,6 +946,7 @@ func EnglishTranslationSet() TranslationSet {
Panel: "Panel",
Keybindings: "Keybindings",
LcRenameBranch: "rename branch",
+ LcSetUnsetUpstream: "set/unset upstream",
NewBranchNamePrompt: "Enter new branch name for branch",
RenameBranchWarning: "This branch is tracking a remote. This action will only rename the local branch name, not the name of the remote branch. Continue?",
LcOpenMenu: "open menu",
@@ -1091,6 +1098,7 @@ func EnglishTranslationSet() TranslationSet {
Merge: "Merge",
RebaseBranch: "Rebase branch",
RenameBranch: "Rename branch",
+ SetUnsetUpstream: "Set/unset upstream",
CreateBranch: "Create branch",
CherryPick: "(Cherry-pick) Paste commits",
CheckoutFile: "Checkout file",
diff --git a/test/integration/setUpstream/expected/origin/config b/test/integration/setUpstream/expected/origin/config
index 63958f045..f97482c61 100644
--- a/test/integration/setUpstream/expected/origin/config
+++ b/test/integration/setUpstream/expected/origin/config
@@ -2,7 +2,5 @@
repositoryformatversion = 0
filemode = true
bare = true
- ignorecase = true
- precomposeunicode = true
[remote "origin"]
- url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/setUpstream/actual/./repo
+ url = /home/mark/Downloads/gits/lazygit/test/integration/setUpstream/actual/./repo
diff --git a/test/integration/setUpstream/expected/origin/info/exclude b/test/integration/setUpstream/expected/origin/info/exclude
index 8e9f2071f..a5196d1be 100644
--- a/test/integration/setUpstream/expected/origin/info/exclude
+++ b/test/integration/setUpstream/expected/origin/info/exclude
@@ -4,4 +4,3 @@
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
-.DS_Store
diff --git a/test/integration/setUpstream/expected/origin/objects/27/58cffdc0d931ff3a3d6c58b75f91ec42981dcf b/test/integration/setUpstream/expected/origin/objects/27/58cffdc0d931ff3a3d6c58b75f91ec42981dcf
new file mode 100644
index 000000000..099d02445
Binary files /dev/null and b/test/integration/setUpstream/expected/origin/objects/27/58cffdc0d931ff3a3d6c58b75f91ec42981dcf differ
diff --git a/test/integration/setUpstream/expected/origin/objects/6d/51185514ab4f80b42f17013295c261f92a66f0 b/test/integration/setUpstream/expected/origin/objects/6d/51185514ab4f80b42f17013295c261f92a66f0
new file mode 100644
index 000000000..d9b4d87b9
Binary files /dev/null and b/test/integration/setUpstream/expected/origin/objects/6d/51185514ab4f80b42f17013295c261f92a66f0 differ
diff --git a/test/integration/setUpstream/expected/origin/objects/9c/663d29d26a71dd67e3bf7b1f2ea73f4939d9e0 b/test/integration/setUpstream/expected/origin/objects/9c/663d29d26a71dd67e3bf7b1f2ea73f4939d9e0
new file mode 100644
index 000000000..7965d6afb
--- /dev/null
+++ b/test/integration/setUpstream/expected/origin/objects/9c/663d29d26a71dd67e3bf7b1f2ea73f4939d9e0
@@ -0,0 +1,3 @@
+xA
+0@Q9i
+"BW=FL!R"~r*JdFY)JՁr.0p~6fw et;uSr?2X,
\ No newline at end of file
diff --git a/test/integration/setUpstream/expected/origin/objects/ce/3220d7b3cbc57811e3e6169349c611f62a7c42 b/test/integration/setUpstream/expected/origin/objects/ce/3220d7b3cbc57811e3e6169349c611f62a7c42
new file mode 100644
index 000000000..19012a4aa
Binary files /dev/null and b/test/integration/setUpstream/expected/origin/objects/ce/3220d7b3cbc57811e3e6169349c611f62a7c42 differ
diff --git a/test/integration/setUpstream/expected/origin/packed-refs b/test/integration/setUpstream/expected/origin/packed-refs
index 300d293d2..f854ff120 100644
--- a/test/integration/setUpstream/expected/origin/packed-refs
+++ b/test/integration/setUpstream/expected/origin/packed-refs
@@ -1,2 +1,2 @@
# pack-refs with: peeled fully-peeled sorted
-30ef3df33d31f0b98298881be4dbe69c54758ba2 refs/heads/master
+ce3220d7b3cbc57811e3e6169349c611f62a7c42 refs/heads/master
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/FETCH_HEAD b/test/integration/setUpstream/expected/repo/.git_keep/FETCH_HEAD
index 125d82b6f..b60b7b2a0 100644
--- a/test/integration/setUpstream/expected/repo/.git_keep/FETCH_HEAD
+++ b/test/integration/setUpstream/expected/repo/.git_keep/FETCH_HEAD
@@ -1 +1 @@
-30ef3df33d31f0b98298881be4dbe69c54758ba2 branch 'master' of ../origin
+ce3220d7b3cbc57811e3e6169349c611f62a7c42 not-for-merge branch 'master' of ../origin
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/ORIG_HEAD b/test/integration/setUpstream/expected/repo/.git_keep/ORIG_HEAD
index 0b53f05ce..6e2a4de9b 100644
--- a/test/integration/setUpstream/expected/repo/.git_keep/ORIG_HEAD
+++ b/test/integration/setUpstream/expected/repo/.git_keep/ORIG_HEAD
@@ -1 +1 @@
-a26a9d22097eb77a8cf2fbb18512aa44c0c536a2
+ce3220d7b3cbc57811e3e6169349c611f62a7c42
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/config b/test/integration/setUpstream/expected/repo/.git_keep/config
index 7721ae814..64b94ff0f 100644
--- a/test/integration/setUpstream/expected/repo/.git_keep/config
+++ b/test/integration/setUpstream/expected/repo/.git_keep/config
@@ -3,8 +3,6 @@
filemode = true
bare = false
logallrefupdates = true
- ignorecase = true
- precomposeunicode = true
[user]
email = CI@example.com
name = CI
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/index b/test/integration/setUpstream/expected/repo/.git_keep/index
index 99e8224eb..25d846403 100644
Binary files a/test/integration/setUpstream/expected/repo/.git_keep/index and b/test/integration/setUpstream/expected/repo/.git_keep/index differ
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/info/exclude b/test/integration/setUpstream/expected/repo/.git_keep/info/exclude
index 8e9f2071f..a5196d1be 100644
--- a/test/integration/setUpstream/expected/repo/.git_keep/info/exclude
+++ b/test/integration/setUpstream/expected/repo/.git_keep/info/exclude
@@ -4,4 +4,3 @@
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
-.DS_Store
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/logs/HEAD b/test/integration/setUpstream/expected/repo/.git_keep/logs/HEAD
index aba248ca8..300481fb2 100644
--- a/test/integration/setUpstream/expected/repo/.git_keep/logs/HEAD
+++ b/test/integration/setUpstream/expected/repo/.git_keep/logs/HEAD
@@ -1,7 +1,5 @@
-0000000000000000000000000000000000000000 6305259d1908bee46b3b686702ed55b6f12e9ba2 CI 1648346253 +1100 commit (initial): myfile1
-6305259d1908bee46b3b686702ed55b6f12e9ba2 a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 CI 1648346253 +1100 commit: myfile2
-a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 c6ffcbed8902934d462722ff6ef471813b9a4df5 CI 1648346253 +1100 commit: myfile3
-c6ffcbed8902934d462722ff6ef471813b9a4df5 30ef3df33d31f0b98298881be4dbe69c54758ba2 CI 1648346253 +1100 commit: myfile4
-30ef3df33d31f0b98298881be4dbe69c54758ba2 a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 CI 1648346253 +1100 reset: moving to HEAD~2
-a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 30ef3df33d31f0b98298881be4dbe69c54758ba2 CI 1648346262 +1100 rebase -i (start): checkout 30ef3df33d31f0b98298881be4dbe69c54758ba2
-30ef3df33d31f0b98298881be4dbe69c54758ba2 30ef3df33d31f0b98298881be4dbe69c54758ba2 CI 1648346262 +1100 rebase -i (finish): returning to refs/heads/master
+0000000000000000000000000000000000000000 9c663d29d26a71dd67e3bf7b1f2ea73f4939d9e0 CI 1650269554 +0200 commit (initial): myfile1
+9c663d29d26a71dd67e3bf7b1f2ea73f4939d9e0 6d51185514ab4f80b42f17013295c261f92a66f0 CI 1650269554 +0200 commit: myfile2
+6d51185514ab4f80b42f17013295c261f92a66f0 2758cffdc0d931ff3a3d6c58b75f91ec42981dcf CI 1650269554 +0200 commit: myfile3
+2758cffdc0d931ff3a3d6c58b75f91ec42981dcf ce3220d7b3cbc57811e3e6169349c611f62a7c42 CI 1650269554 +0200 commit: myfile4
+ce3220d7b3cbc57811e3e6169349c611f62a7c42 6d51185514ab4f80b42f17013295c261f92a66f0 CI 1650269554 +0200 reset: moving to HEAD~2
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/setUpstream/expected/repo/.git_keep/logs/refs/heads/master
index e0e98143e..300481fb2 100644
--- a/test/integration/setUpstream/expected/repo/.git_keep/logs/refs/heads/master
+++ b/test/integration/setUpstream/expected/repo/.git_keep/logs/refs/heads/master
@@ -1,6 +1,5 @@
-0000000000000000000000000000000000000000 6305259d1908bee46b3b686702ed55b6f12e9ba2 CI 1648346253 +1100 commit (initial): myfile1
-6305259d1908bee46b3b686702ed55b6f12e9ba2 a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 CI 1648346253 +1100 commit: myfile2
-a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 c6ffcbed8902934d462722ff6ef471813b9a4df5 CI 1648346253 +1100 commit: myfile3
-c6ffcbed8902934d462722ff6ef471813b9a4df5 30ef3df33d31f0b98298881be4dbe69c54758ba2 CI 1648346253 +1100 commit: myfile4
-30ef3df33d31f0b98298881be4dbe69c54758ba2 a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 CI 1648346253 +1100 reset: moving to HEAD~2
-a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 30ef3df33d31f0b98298881be4dbe69c54758ba2 CI 1648346262 +1100 rebase -i (finish): refs/heads/master onto 30ef3df33d31f0b98298881be4dbe69c54758ba2
+0000000000000000000000000000000000000000 9c663d29d26a71dd67e3bf7b1f2ea73f4939d9e0 CI 1650269554 +0200 commit (initial): myfile1
+9c663d29d26a71dd67e3bf7b1f2ea73f4939d9e0 6d51185514ab4f80b42f17013295c261f92a66f0 CI 1650269554 +0200 commit: myfile2
+6d51185514ab4f80b42f17013295c261f92a66f0 2758cffdc0d931ff3a3d6c58b75f91ec42981dcf CI 1650269554 +0200 commit: myfile3
+2758cffdc0d931ff3a3d6c58b75f91ec42981dcf ce3220d7b3cbc57811e3e6169349c611f62a7c42 CI 1650269554 +0200 commit: myfile4
+ce3220d7b3cbc57811e3e6169349c611f62a7c42 6d51185514ab4f80b42f17013295c261f92a66f0 CI 1650269554 +0200 reset: moving to HEAD~2
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/logs/refs/remotes/origin/master b/test/integration/setUpstream/expected/repo/.git_keep/logs/refs/remotes/origin/master
index 774c65ed0..ade370956 100644
--- a/test/integration/setUpstream/expected/repo/.git_keep/logs/refs/remotes/origin/master
+++ b/test/integration/setUpstream/expected/repo/.git_keep/logs/refs/remotes/origin/master
@@ -1 +1 @@
-0000000000000000000000000000000000000000 30ef3df33d31f0b98298881be4dbe69c54758ba2 CI 1648346260 +1100 fetch origin: storing head
+0000000000000000000000000000000000000000 ce3220d7b3cbc57811e3e6169349c611f62a7c42 CI 1650269559 +0200 fetch origin: storing head
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/objects/27/58cffdc0d931ff3a3d6c58b75f91ec42981dcf b/test/integration/setUpstream/expected/repo/.git_keep/objects/27/58cffdc0d931ff3a3d6c58b75f91ec42981dcf
new file mode 100644
index 000000000..099d02445
Binary files /dev/null and b/test/integration/setUpstream/expected/repo/.git_keep/objects/27/58cffdc0d931ff3a3d6c58b75f91ec42981dcf differ
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/objects/6d/51185514ab4f80b42f17013295c261f92a66f0 b/test/integration/setUpstream/expected/repo/.git_keep/objects/6d/51185514ab4f80b42f17013295c261f92a66f0
new file mode 100644
index 000000000..d9b4d87b9
Binary files /dev/null and b/test/integration/setUpstream/expected/repo/.git_keep/objects/6d/51185514ab4f80b42f17013295c261f92a66f0 differ
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/objects/9c/663d29d26a71dd67e3bf7b1f2ea73f4939d9e0 b/test/integration/setUpstream/expected/repo/.git_keep/objects/9c/663d29d26a71dd67e3bf7b1f2ea73f4939d9e0
new file mode 100644
index 000000000..7965d6afb
--- /dev/null
+++ b/test/integration/setUpstream/expected/repo/.git_keep/objects/9c/663d29d26a71dd67e3bf7b1f2ea73f4939d9e0
@@ -0,0 +1,3 @@
+xA
+0@Q9i
+"BW=FL!R"~r*JdFY)JՁr.0p~6fw et;uSr?2X,
\ No newline at end of file
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/objects/ce/3220d7b3cbc57811e3e6169349c611f62a7c42 b/test/integration/setUpstream/expected/repo/.git_keep/objects/ce/3220d7b3cbc57811e3e6169349c611f62a7c42
new file mode 100644
index 000000000..19012a4aa
Binary files /dev/null and b/test/integration/setUpstream/expected/repo/.git_keep/objects/ce/3220d7b3cbc57811e3e6169349c611f62a7c42 differ
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/refs/heads/master b/test/integration/setUpstream/expected/repo/.git_keep/refs/heads/master
index af1728373..0147cfa3f 100644
--- a/test/integration/setUpstream/expected/repo/.git_keep/refs/heads/master
+++ b/test/integration/setUpstream/expected/repo/.git_keep/refs/heads/master
@@ -1 +1 @@
-30ef3df33d31f0b98298881be4dbe69c54758ba2
+6d51185514ab4f80b42f17013295c261f92a66f0
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/refs/remotes/origin/master b/test/integration/setUpstream/expected/repo/.git_keep/refs/remotes/origin/master
index af1728373..6e2a4de9b 100644
--- a/test/integration/setUpstream/expected/repo/.git_keep/refs/remotes/origin/master
+++ b/test/integration/setUpstream/expected/repo/.git_keep/refs/remotes/origin/master
@@ -1 +1 @@
-30ef3df33d31f0b98298881be4dbe69c54758ba2
+ce3220d7b3cbc57811e3e6169349c611f62a7c42
diff --git a/test/integration/setUpstream/recording.json b/test/integration/setUpstream/recording.json
index 8776559d9..a84937cc7 100644
--- a/test/integration/setUpstream/recording.json
+++ b/test/integration/setUpstream/recording.json
@@ -1 +1 @@
-{"KeyEvents":[{"Timestamp":808,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1221,"Mod":0,"Key":256,"Ch":93},{"Timestamp":1598,"Mod":0,"Key":256,"Ch":110},{"Timestamp":2267,"Mod":0,"Key":256,"Ch":111},{"Timestamp":2399,"Mod":0,"Key":256,"Ch":114},{"Timestamp":2500,"Mod":0,"Key":256,"Ch":105},{"Timestamp":2573,"Mod":0,"Key":256,"Ch":103},{"Timestamp":2634,"Mod":0,"Key":256,"Ch":105},{"Timestamp":2710,"Mod":0,"Key":256,"Ch":110},{"Timestamp":3042,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3671,"Mod":0,"Key":256,"Ch":46},{"Timestamp":4001,"Mod":0,"Key":256,"Ch":46},{"Timestamp":4215,"Mod":0,"Key":256,"Ch":47},{"Timestamp":4511,"Mod":0,"Key":256,"Ch":111},{"Timestamp":4896,"Mod":0,"Key":256,"Ch":114},{"Timestamp":5008,"Mod":0,"Key":256,"Ch":105},{"Timestamp":5133,"Mod":0,"Key":256,"Ch":103},{"Timestamp":5202,"Mod":0,"Key":256,"Ch":105},{"Timestamp":5255,"Mod":0,"Key":256,"Ch":110},{"Timestamp":5558,"Mod":0,"Key":13,"Ch":13},{"Timestamp":6247,"Mod":0,"Key":256,"Ch":102},{"Timestamp":7072,"Mod":0,"Key":256,"Ch":91},{"Timestamp":7716,"Mod":0,"Key":256,"Ch":112},{"Timestamp":8319,"Mod":0,"Key":13,"Ch":13},{"Timestamp":9159,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":254,"Height":74}]}
\ No newline at end of file
+{"KeyEvents":[{"Timestamp":558,"Mod":0,"Key":256,"Ch":108},{"Timestamp":992,"Mod":0,"Key":256,"Ch":93},{"Timestamp":1583,"Mod":0,"Key":256,"Ch":110},{"Timestamp":2109,"Mod":0,"Key":256,"Ch":111},{"Timestamp":2232,"Mod":0,"Key":256,"Ch":114},{"Timestamp":2278,"Mod":0,"Key":256,"Ch":105},{"Timestamp":2413,"Mod":0,"Key":256,"Ch":103},{"Timestamp":2478,"Mod":0,"Key":256,"Ch":105},{"Timestamp":2538,"Mod":0,"Key":256,"Ch":110},{"Timestamp":2831,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3060,"Mod":0,"Key":256,"Ch":46},{"Timestamp":3234,"Mod":0,"Key":256,"Ch":46},{"Timestamp":3293,"Mod":0,"Key":256,"Ch":47},{"Timestamp":3454,"Mod":0,"Key":256,"Ch":111},{"Timestamp":3594,"Mod":0,"Key":256,"Ch":114},{"Timestamp":3632,"Mod":0,"Key":256,"Ch":105},{"Timestamp":3780,"Mod":0,"Key":256,"Ch":103},{"Timestamp":3831,"Mod":0,"Key":256,"Ch":105},{"Timestamp":3890,"Mod":0,"Key":256,"Ch":110},{"Timestamp":4150,"Mod":0,"Key":13,"Ch":13},{"Timestamp":4695,"Mod":0,"Key":256,"Ch":102},{"Timestamp":5433,"Mod":0,"Key":256,"Ch":91},{"Timestamp":6106,"Mod":0,"Key":256,"Ch":117},{"Timestamp":6884,"Mod":0,"Key":256,"Ch":115},{"Timestamp":7833,"Mod":0,"Key":9,"Ch":9},{"Timestamp":8301,"Mod":0,"Key":13,"Ch":13},{"Timestamp":9114,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":239,"Height":55}]}
\ No newline at end of file
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/HEAD b/test/integration/setUpstreamThroughPush/expected/origin/HEAD
new file mode 100644
index 000000000..cb089cd89
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/origin/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/config b/test/integration/setUpstreamThroughPush/expected/origin/config
new file mode 100644
index 000000000..63958f045
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/origin/config
@@ -0,0 +1,8 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = true
+ ignorecase = true
+ precomposeunicode = true
+[remote "origin"]
+ url = /Users/jesseduffieldduffield/go/src/github.com/jesseduffield/lazygit/test/integration/setUpstream/actual/./repo
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/description b/test/integration/setUpstreamThroughPush/expected/origin/description
new file mode 100644
index 000000000..498b267a8
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/origin/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/info/exclude b/test/integration/setUpstreamThroughPush/expected/origin/info/exclude
new file mode 100644
index 000000000..8e9f2071f
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/origin/info/exclude
@@ -0,0 +1,7 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
+.DS_Store
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/setUpstreamThroughPush/expected/origin/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52
new file mode 100644
index 000000000..7f2ebf4ee
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/origin/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/setUpstreamThroughPush/expected/origin/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827
new file mode 100644
index 000000000..f74bf2335
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/origin/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/setUpstreamThroughPush/expected/origin/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce
new file mode 100644
index 000000000..0a734f981
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/origin/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/setUpstreamThroughPush/expected/origin/objects/2f/6174050380438f14b16658a356e762435ca591
new file mode 100644
index 000000000..31ae3f5ba
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/origin/objects/2f/6174050380438f14b16658a356e762435ca591 differ
diff --git a/test/integration/setUpstream/expected/origin/objects/30/ef3df33d31f0b98298881be4dbe69c54758ba2 b/test/integration/setUpstreamThroughPush/expected/origin/objects/30/ef3df33d31f0b98298881be4dbe69c54758ba2
similarity index 100%
rename from test/integration/setUpstream/expected/origin/objects/30/ef3df33d31f0b98298881be4dbe69c54758ba2
rename to test/integration/setUpstreamThroughPush/expected/origin/objects/30/ef3df33d31f0b98298881be4dbe69c54758ba2
diff --git a/test/integration/setUpstream/expected/origin/objects/63/05259d1908bee46b3b686702ed55b6f12e9ba2 b/test/integration/setUpstreamThroughPush/expected/origin/objects/63/05259d1908bee46b3b686702ed55b6f12e9ba2
similarity index 100%
rename from test/integration/setUpstream/expected/origin/objects/63/05259d1908bee46b3b686702ed55b6f12e9ba2
rename to test/integration/setUpstreamThroughPush/expected/origin/objects/63/05259d1908bee46b3b686702ed55b6f12e9ba2
diff --git a/test/integration/setUpstream/expected/origin/objects/a2/6a9d22097eb77a8cf2fbb18512aa44c0c536a2 b/test/integration/setUpstreamThroughPush/expected/origin/objects/a2/6a9d22097eb77a8cf2fbb18512aa44c0c536a2
similarity index 100%
rename from test/integration/setUpstream/expected/origin/objects/a2/6a9d22097eb77a8cf2fbb18512aa44c0c536a2
rename to test/integration/setUpstreamThroughPush/expected/origin/objects/a2/6a9d22097eb77a8cf2fbb18512aa44c0c536a2
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/setUpstreamThroughPush/expected/origin/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5
new file mode 100644
index 000000000..285df3e5f
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/origin/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/setUpstreamThroughPush/expected/origin/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416
new file mode 100644
index 000000000..96d2e71a6
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/origin/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ
diff --git a/test/integration/setUpstream/expected/origin/objects/c6/ffcbed8902934d462722ff6ef471813b9a4df5 b/test/integration/setUpstreamThroughPush/expected/origin/objects/c6/ffcbed8902934d462722ff6ef471813b9a4df5
similarity index 100%
rename from test/integration/setUpstream/expected/origin/objects/c6/ffcbed8902934d462722ff6ef471813b9a4df5
rename to test/integration/setUpstreamThroughPush/expected/origin/objects/c6/ffcbed8902934d462722ff6ef471813b9a4df5
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/setUpstreamThroughPush/expected/origin/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54
new file mode 100644
index 000000000..d39fa7d2f
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/origin/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/setUpstreamThroughPush/expected/origin/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b
new file mode 100644
index 000000000..9b771fc2f
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/origin/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ
diff --git a/test/integration/setUpstreamThroughPush/expected/origin/packed-refs b/test/integration/setUpstreamThroughPush/expected/origin/packed-refs
new file mode 100644
index 000000000..300d293d2
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/origin/packed-refs
@@ -0,0 +1,2 @@
+# pack-refs with: peeled fully-peeled sorted
+30ef3df33d31f0b98298881be4dbe69c54758ba2 refs/heads/master
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/COMMIT_EDITMSG
new file mode 100644
index 000000000..51be8ec3d
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/COMMIT_EDITMSG
@@ -0,0 +1 @@
+myfile4
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/FETCH_HEAD b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/FETCH_HEAD
new file mode 100644
index 000000000..125d82b6f
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/FETCH_HEAD
@@ -0,0 +1 @@
+30ef3df33d31f0b98298881be4dbe69c54758ba2 branch 'master' of ../origin
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/HEAD b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/HEAD
new file mode 100644
index 000000000..cb089cd89
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/ORIG_HEAD b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/ORIG_HEAD
new file mode 100644
index 000000000..0b53f05ce
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/ORIG_HEAD
@@ -0,0 +1 @@
+a26a9d22097eb77a8cf2fbb18512aa44c0c536a2
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/config b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/config
new file mode 100644
index 000000000..7721ae814
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/config
@@ -0,0 +1,16 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = false
+ logallrefupdates = true
+ ignorecase = true
+ precomposeunicode = true
+[user]
+ email = CI@example.com
+ name = CI
+[remote "origin"]
+ url = ../origin
+ fetch = +refs/heads/*:refs/remotes/origin/*
+[branch "master"]
+ remote = origin
+ merge = refs/heads/master
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/description b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/description
new file mode 100644
index 000000000..498b267a8
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/index b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/index
new file mode 100644
index 000000000..99e8224eb
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/index differ
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/info/exclude b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/info/exclude
new file mode 100644
index 000000000..8e9f2071f
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/info/exclude
@@ -0,0 +1,7 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
+.DS_Store
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/logs/HEAD b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/logs/HEAD
new file mode 100644
index 000000000..aba248ca8
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/logs/HEAD
@@ -0,0 +1,7 @@
+0000000000000000000000000000000000000000 6305259d1908bee46b3b686702ed55b6f12e9ba2 CI 1648346253 +1100 commit (initial): myfile1
+6305259d1908bee46b3b686702ed55b6f12e9ba2 a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 CI 1648346253 +1100 commit: myfile2
+a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 c6ffcbed8902934d462722ff6ef471813b9a4df5 CI 1648346253 +1100 commit: myfile3
+c6ffcbed8902934d462722ff6ef471813b9a4df5 30ef3df33d31f0b98298881be4dbe69c54758ba2 CI 1648346253 +1100 commit: myfile4
+30ef3df33d31f0b98298881be4dbe69c54758ba2 a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 CI 1648346253 +1100 reset: moving to HEAD~2
+a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 30ef3df33d31f0b98298881be4dbe69c54758ba2 CI 1648346262 +1100 rebase -i (start): checkout 30ef3df33d31f0b98298881be4dbe69c54758ba2
+30ef3df33d31f0b98298881be4dbe69c54758ba2 30ef3df33d31f0b98298881be4dbe69c54758ba2 CI 1648346262 +1100 rebase -i (finish): returning to refs/heads/master
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/logs/refs/heads/master
new file mode 100644
index 000000000..e0e98143e
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/logs/refs/heads/master
@@ -0,0 +1,6 @@
+0000000000000000000000000000000000000000 6305259d1908bee46b3b686702ed55b6f12e9ba2 CI 1648346253 +1100 commit (initial): myfile1
+6305259d1908bee46b3b686702ed55b6f12e9ba2 a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 CI 1648346253 +1100 commit: myfile2
+a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 c6ffcbed8902934d462722ff6ef471813b9a4df5 CI 1648346253 +1100 commit: myfile3
+c6ffcbed8902934d462722ff6ef471813b9a4df5 30ef3df33d31f0b98298881be4dbe69c54758ba2 CI 1648346253 +1100 commit: myfile4
+30ef3df33d31f0b98298881be4dbe69c54758ba2 a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 CI 1648346253 +1100 reset: moving to HEAD~2
+a26a9d22097eb77a8cf2fbb18512aa44c0c536a2 30ef3df33d31f0b98298881be4dbe69c54758ba2 CI 1648346262 +1100 rebase -i (finish): refs/heads/master onto 30ef3df33d31f0b98298881be4dbe69c54758ba2
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/logs/refs/remotes/origin/master b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/logs/refs/remotes/origin/master
new file mode 100644
index 000000000..774c65ed0
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/logs/refs/remotes/origin/master
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 30ef3df33d31f0b98298881be4dbe69c54758ba2 CI 1648346260 +1100 fetch origin: storing head
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52
new file mode 100644
index 000000000..7f2ebf4ee
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827
new file mode 100644
index 000000000..f74bf2335
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce
new file mode 100644
index 000000000..0a734f981
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/2b/173c861df433fa43ffad13f80c8b312c5c8bce differ
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591
new file mode 100644
index 000000000..31ae3f5ba
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/2f/6174050380438f14b16658a356e762435ca591 differ
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/objects/30/ef3df33d31f0b98298881be4dbe69c54758ba2 b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/30/ef3df33d31f0b98298881be4dbe69c54758ba2
similarity index 100%
rename from test/integration/setUpstream/expected/repo/.git_keep/objects/30/ef3df33d31f0b98298881be4dbe69c54758ba2
rename to test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/30/ef3df33d31f0b98298881be4dbe69c54758ba2
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/objects/63/05259d1908bee46b3b686702ed55b6f12e9ba2 b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/63/05259d1908bee46b3b686702ed55b6f12e9ba2
similarity index 100%
rename from test/integration/setUpstream/expected/repo/.git_keep/objects/63/05259d1908bee46b3b686702ed55b6f12e9ba2
rename to test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/63/05259d1908bee46b3b686702ed55b6f12e9ba2
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/objects/a2/6a9d22097eb77a8cf2fbb18512aa44c0c536a2 b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/a2/6a9d22097eb77a8cf2fbb18512aa44c0c536a2
similarity index 100%
rename from test/integration/setUpstream/expected/repo/.git_keep/objects/a2/6a9d22097eb77a8cf2fbb18512aa44c0c536a2
rename to test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/a2/6a9d22097eb77a8cf2fbb18512aa44c0c536a2
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5
new file mode 100644
index 000000000..285df3e5f
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/a5/bce3fd2565d8f458555a0c6f42d0504a848bd5 differ
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416
new file mode 100644
index 000000000..96d2e71a6
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/a7/341a59f0ddeef969e69fb6368266d22b0f2416 differ
diff --git a/test/integration/setUpstream/expected/repo/.git_keep/objects/c6/ffcbed8902934d462722ff6ef471813b9a4df5 b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/c6/ffcbed8902934d462722ff6ef471813b9a4df5
similarity index 100%
rename from test/integration/setUpstream/expected/repo/.git_keep/objects/c6/ffcbed8902934d462722ff6ef471813b9a4df5
rename to test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/c6/ffcbed8902934d462722ff6ef471813b9a4df5
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54
new file mode 100644
index 000000000..d39fa7d2f
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/d2/34c5e057fe32c676ea67e8cb38f4625ddaeb54 differ
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b
new file mode 100644
index 000000000..9b771fc2f
Binary files /dev/null and b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/objects/df/6b0d2bcc76e6ec0fca20c227104a4f28bac41b differ
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/refs/heads/master b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/refs/heads/master
new file mode 100644
index 000000000..af1728373
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/refs/heads/master
@@ -0,0 +1 @@
+30ef3df33d31f0b98298881be4dbe69c54758ba2
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/refs/remotes/origin/master b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/refs/remotes/origin/master
new file mode 100644
index 000000000..af1728373
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/.git_keep/refs/remotes/origin/master
@@ -0,0 +1 @@
+30ef3df33d31f0b98298881be4dbe69c54758ba2
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/myfile1 b/test/integration/setUpstreamThroughPush/expected/repo/myfile1
new file mode 100644
index 000000000..a5bce3fd2
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/myfile1
@@ -0,0 +1 @@
+test1
diff --git a/test/integration/setUpstreamThroughPush/expected/repo/myfile2 b/test/integration/setUpstreamThroughPush/expected/repo/myfile2
new file mode 100644
index 000000000..180cf8328
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/expected/repo/myfile2
@@ -0,0 +1 @@
+test2
diff --git a/test/integration/setUpstream/expected/repo/myfile3 b/test/integration/setUpstreamThroughPush/expected/repo/myfile3
similarity index 100%
rename from test/integration/setUpstream/expected/repo/myfile3
rename to test/integration/setUpstreamThroughPush/expected/repo/myfile3
diff --git a/test/integration/setUpstream/expected/repo/myfile4 b/test/integration/setUpstreamThroughPush/expected/repo/myfile4
similarity index 100%
rename from test/integration/setUpstream/expected/repo/myfile4
rename to test/integration/setUpstreamThroughPush/expected/repo/myfile4
diff --git a/test/integration/setUpstreamThroughPush/recording.json b/test/integration/setUpstreamThroughPush/recording.json
new file mode 100644
index 000000000..8776559d9
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/recording.json
@@ -0,0 +1 @@
+{"KeyEvents":[{"Timestamp":808,"Mod":0,"Key":259,"Ch":0},{"Timestamp":1221,"Mod":0,"Key":256,"Ch":93},{"Timestamp":1598,"Mod":0,"Key":256,"Ch":110},{"Timestamp":2267,"Mod":0,"Key":256,"Ch":111},{"Timestamp":2399,"Mod":0,"Key":256,"Ch":114},{"Timestamp":2500,"Mod":0,"Key":256,"Ch":105},{"Timestamp":2573,"Mod":0,"Key":256,"Ch":103},{"Timestamp":2634,"Mod":0,"Key":256,"Ch":105},{"Timestamp":2710,"Mod":0,"Key":256,"Ch":110},{"Timestamp":3042,"Mod":0,"Key":13,"Ch":13},{"Timestamp":3671,"Mod":0,"Key":256,"Ch":46},{"Timestamp":4001,"Mod":0,"Key":256,"Ch":46},{"Timestamp":4215,"Mod":0,"Key":256,"Ch":47},{"Timestamp":4511,"Mod":0,"Key":256,"Ch":111},{"Timestamp":4896,"Mod":0,"Key":256,"Ch":114},{"Timestamp":5008,"Mod":0,"Key":256,"Ch":105},{"Timestamp":5133,"Mod":0,"Key":256,"Ch":103},{"Timestamp":5202,"Mod":0,"Key":256,"Ch":105},{"Timestamp":5255,"Mod":0,"Key":256,"Ch":110},{"Timestamp":5558,"Mod":0,"Key":13,"Ch":13},{"Timestamp":6247,"Mod":0,"Key":256,"Ch":102},{"Timestamp":7072,"Mod":0,"Key":256,"Ch":91},{"Timestamp":7716,"Mod":0,"Key":256,"Ch":112},{"Timestamp":8319,"Mod":0,"Key":13,"Ch":13},{"Timestamp":9159,"Mod":0,"Key":256,"Ch":113}],"ResizeEvents":[{"Timestamp":0,"Width":254,"Height":74}]}
\ No newline at end of file
diff --git a/test/integration/setUpstreamThroughPush/setup.sh b/test/integration/setUpstreamThroughPush/setup.sh
new file mode 100644
index 000000000..d0bc91327
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/setup.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+set -e
+
+set -e
+
+cd $1
+
+git init
+
+git config user.email "CI@example.com"
+git config user.name "CI"
+
+echo test1 > myfile1
+git add .
+git commit -am "myfile1"
+echo test2 > myfile2
+git add .
+git commit -am "myfile2"
+echo test3 > myfile3
+git add .
+git commit -am "myfile3"
+echo test4 > myfile4
+git add .
+git commit -am "myfile4"
+
+cd ..
+git clone --bare ./repo origin
+
+cd repo
+
+git reset --hard HEAD~2
diff --git a/test/integration/setUpstreamThroughPush/test.json b/test/integration/setUpstreamThroughPush/test.json
new file mode 100644
index 000000000..11fdee3ab
--- /dev/null
+++ b/test/integration/setUpstreamThroughPush/test.json
@@ -0,0 +1 @@
+{ "description": "allow setting the upstream of the current branch when pushing", "speed": 10 }
diff --git a/test/integration/unsetUpstream/expected/origin/HEAD b/test/integration/unsetUpstream/expected/origin/HEAD
new file mode 100644
index 000000000..cb089cd89
--- /dev/null
+++ b/test/integration/unsetUpstream/expected/origin/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/test/integration/unsetUpstream/expected/origin/config b/test/integration/unsetUpstream/expected/origin/config
new file mode 100644
index 000000000..56c5e2484
--- /dev/null
+++ b/test/integration/unsetUpstream/expected/origin/config
@@ -0,0 +1,6 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = true
+[remote "origin"]
+ url = /home/mark/Downloads/gits/lazygit/test/integration/unsetUpstream/actual/./repo
diff --git a/test/integration/unsetUpstream/expected/origin/description b/test/integration/unsetUpstream/expected/origin/description
new file mode 100644
index 000000000..498b267a8
--- /dev/null
+++ b/test/integration/unsetUpstream/expected/origin/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/test/integration/unsetUpstream/expected/origin/info/exclude b/test/integration/unsetUpstream/expected/origin/info/exclude
new file mode 100644
index 000000000..a5196d1be
--- /dev/null
+++ b/test/integration/unsetUpstream/expected/origin/info/exclude
@@ -0,0 +1,6 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
diff --git a/test/integration/unsetUpstream/expected/origin/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/unsetUpstream/expected/origin/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52
new file mode 100644
index 000000000..7f2ebf4ee
Binary files /dev/null and b/test/integration/unsetUpstream/expected/origin/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ
diff --git a/test/integration/unsetUpstream/expected/origin/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/unsetUpstream/expected/origin/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827
new file mode 100644
index 000000000..f74bf2335
Binary files /dev/null and b/test/integration/unsetUpstream/expected/origin/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ
diff --git a/test/integration/unsetUpstream/expected/origin/objects/24/351b001b63ca15b6b83542ffb765567e17df23 b/test/integration/unsetUpstream/expected/origin/objects/24/351b001b63ca15b6b83542ffb765567e17df23
new file mode 100644
index 000000000..5167b74e4
Binary files /dev/null and b/test/integration/unsetUpstream/expected/origin/objects/24/351b001b63ca15b6b83542ffb765567e17df23 differ
diff --git a/test/integration/unsetUpstream/expected/origin/objects/28/9b2354ac3770d96fc3fcfd2a8026fc78a32cc5 b/test/integration/unsetUpstream/expected/origin/objects/28/9b2354ac3770d96fc3fcfd2a8026fc78a32cc5
new file mode 100644
index 000000000..8283ae159
--- /dev/null
+++ b/test/integration/unsetUpstream/expected/origin/objects/28/9b2354ac3770d96fc3fcfd2a8026fc78a32cc5
@@ -0,0 +1,3 @@
+xA
+0@Q9I
+"BW=FL!R"~r*Jd ¬DjE 1650269774 +0200 commit (initial): myfile1
+289b2354ac3770d96fc3fcfd2a8026fc78a32cc5 7010e33e20178a1a179853948691a9036d48e562 CI 1650269774 +0200 commit: myfile2
+7010e33e20178a1a179853948691a9036d48e562 994a4733eacc0000721e01a177704e2f26216510 CI 1650269774 +0200 commit: myfile3
+994a4733eacc0000721e01a177704e2f26216510 24351b001b63ca15b6b83542ffb765567e17df23 CI 1650269774 +0200 commit: myfile4
+24351b001b63ca15b6b83542ffb765567e17df23 7010e33e20178a1a179853948691a9036d48e562 CI 1650269774 +0200 reset: moving to HEAD~2
diff --git a/test/integration/unsetUpstream/expected/repo/.git_keep/logs/refs/heads/master b/test/integration/unsetUpstream/expected/repo/.git_keep/logs/refs/heads/master
new file mode 100644
index 000000000..1bc609ea6
--- /dev/null
+++ b/test/integration/unsetUpstream/expected/repo/.git_keep/logs/refs/heads/master
@@ -0,0 +1,5 @@
+0000000000000000000000000000000000000000 289b2354ac3770d96fc3fcfd2a8026fc78a32cc5 CI 1650269774 +0200 commit (initial): myfile1
+289b2354ac3770d96fc3fcfd2a8026fc78a32cc5 7010e33e20178a1a179853948691a9036d48e562 CI 1650269774 +0200 commit: myfile2
+7010e33e20178a1a179853948691a9036d48e562 994a4733eacc0000721e01a177704e2f26216510 CI 1650269774 +0200 commit: myfile3
+994a4733eacc0000721e01a177704e2f26216510 24351b001b63ca15b6b83542ffb765567e17df23 CI 1650269774 +0200 commit: myfile4
+24351b001b63ca15b6b83542ffb765567e17df23 7010e33e20178a1a179853948691a9036d48e562 CI 1650269774 +0200 reset: moving to HEAD~2
diff --git a/test/integration/unsetUpstream/expected/repo/.git_keep/logs/refs/remotes/origin/master b/test/integration/unsetUpstream/expected/repo/.git_keep/logs/refs/remotes/origin/master
new file mode 100644
index 000000000..cbf8607af
--- /dev/null
+++ b/test/integration/unsetUpstream/expected/repo/.git_keep/logs/refs/remotes/origin/master
@@ -0,0 +1 @@
+0000000000000000000000000000000000000000 24351b001b63ca15b6b83542ffb765567e17df23 CI 1650269774 +0200 fetch origin: storing head
diff --git a/test/integration/unsetUpstream/expected/repo/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 b/test/integration/unsetUpstream/expected/repo/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52
new file mode 100644
index 000000000..7f2ebf4ee
Binary files /dev/null and b/test/integration/unsetUpstream/expected/repo/.git_keep/objects/0e/6cf0a6b79e8d44e186d812a1f74b43d64fac52 differ
diff --git a/test/integration/unsetUpstream/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 b/test/integration/unsetUpstream/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827
new file mode 100644
index 000000000..f74bf2335
Binary files /dev/null and b/test/integration/unsetUpstream/expected/repo/.git_keep/objects/18/0cf8328022becee9aaa2577a8f84ea2b9f3827 differ
diff --git a/test/integration/unsetUpstream/expected/repo/.git_keep/objects/24/351b001b63ca15b6b83542ffb765567e17df23 b/test/integration/unsetUpstream/expected/repo/.git_keep/objects/24/351b001b63ca15b6b83542ffb765567e17df23
new file mode 100644
index 000000000..5167b74e4
Binary files /dev/null and b/test/integration/unsetUpstream/expected/repo/.git_keep/objects/24/351b001b63ca15b6b83542ffb765567e17df23 differ
diff --git a/test/integration/unsetUpstream/expected/repo/.git_keep/objects/28/9b2354ac3770d96fc3fcfd2a8026fc78a32cc5 b/test/integration/unsetUpstream/expected/repo/.git_keep/objects/28/9b2354ac3770d96fc3fcfd2a8026fc78a32cc5
new file mode 100644
index 000000000..8283ae159
--- /dev/null
+++ b/test/integration/unsetUpstream/expected/repo/.git_keep/objects/28/9b2354ac3770d96fc3fcfd2a8026fc78a32cc5
@@ -0,0 +1,3 @@
+xA
+0@Q9I
+"BW=FL!R"~r*Jd ¬DjE myfile1
+git add .
+git commit -am "myfile1"
+echo test2 > myfile2
+git add .
+git commit -am "myfile2"
+echo test3 > myfile3
+git add .
+git commit -am "myfile3"
+echo test4 > myfile4
+git add .
+git commit -am "myfile4"
+
+cd ..
+git clone --bare ./repo origin
+
+cd repo
+
+git reset --hard HEAD~2
+git remote add origin ../origin
+git fetch origin
+git branch --set-upstream-to=origin/master
+
diff --git a/test/integration/unsetUpstream/test.json b/test/integration/unsetUpstream/test.json
new file mode 100644
index 000000000..dffe129cd
--- /dev/null
+++ b/test/integration/unsetUpstream/test.json
@@ -0,0 +1 @@
+{ "description": "allow unsetting the upstream of the current branch", "speed": 10 }