diff --git a/src/ViewModels/Push.cs b/src/ViewModels/Push.cs index 5bbb9858..917935b0 100644 --- a/src/ViewModels/Push.cs +++ b/src/ViewModels/Push.cs @@ -114,6 +114,9 @@ namespace SourceGit.ViewModels // Set default selected local branch. if (localBranch != null) { + if (LocalBranches.Count == 0) + LocalBranches.Add(localBranch); + _selectedLocalBranch = localBranch; HasSpecifiedLocalBranch = true; } diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index 29c8a13f..ef6f0996 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -1733,7 +1733,18 @@ namespace SourceGit.ViewModels UseAmend = false; if (autoPush && _repo.Remotes.Count > 0) - _repo.ShowAndStartPopup(new Push(_repo, null)); + { + if (_repo.CurrentBranch == null) + { + var currentBranchName = Commands.Branch.ShowCurrent(_repo.FullPath); + var tmp = new Models.Branch() { Name = currentBranchName }; + _repo.ShowAndStartPopup(new Push(_repo, tmp)); + } + else + { + _repo.ShowAndStartPopup(new Push(_repo, null)); + } + } } _repo.MarkBranchesDirtyManually();