diff --git a/CodeEdit/Features/SourceControl/Client/GitClient+Push.swift b/CodeEdit/Features/SourceControl/Client/GitClient+Push.swift index aa0f08e852..4295c075ae 100644 --- a/CodeEdit/Features/SourceControl/Client/GitClient+Push.swift +++ b/CodeEdit/Features/SourceControl/Client/GitClient+Push.swift @@ -9,12 +9,24 @@ import Foundation extension GitClient { /// Push changes to remote - func pushToRemote(remote: String? = nil, branch: String? = nil, setUpstream: Bool? = false ) async throws { + func pushToRemote( + remote: String? = nil, + branch: String? = nil, + setUpstream: Bool? = false, + force: Bool? = false, + tags: Bool? = false + ) async throws { var command = "push" if let remote, let branch { if setUpstream == true { command += " --set-upstream" } + if force == true { + command += " --force" + } + if tags == true { + command += " --tags" + } command += " \(remote) \(branch)" } diff --git a/CodeEdit/Features/SourceControl/SourceControlManager+GitClient.swift b/CodeEdit/Features/SourceControl/SourceControlManager+GitClient.swift index 745178f8a4..0c6b6d990b 100644 --- a/CodeEdit/Features/SourceControl/SourceControlManager+GitClient.swift +++ b/CodeEdit/Features/SourceControl/SourceControlManager+GitClient.swift @@ -288,10 +288,22 @@ extension SourceControlManager { } /// Push changes to remote - func push(remote: String? = nil, branch: String? = nil, setUpstream: Bool = false) async throws { + func push( + remote: String? = nil, + branch: String? = nil, + setUpstream: Bool = false, + force: Bool = false, + tags: Bool = false + ) async throws { guard currentBranch != nil else { return } - try await gitClient.pushToRemote(remote: remote, branch: branch, setUpstream: setUpstream) + try await gitClient.pushToRemote( + remote: remote, + branch: branch, + setUpstream: setUpstream, + force: force, + tags: tags + ) await refreshCurrentBranch() await self.refreshNumberOfUnsyncedCommits() diff --git a/CodeEdit/Features/SourceControl/Views/SourceControlPushView.swift b/CodeEdit/Features/SourceControl/Views/SourceControlPushView.swift index 2fa8f797a4..8b280cb806 100644 --- a/CodeEdit/Features/SourceControl/Views/SourceControlPushView.swift +++ b/CodeEdit/Features/SourceControl/Views/SourceControlPushView.swift @@ -75,7 +75,9 @@ struct SourceControlPushView: View { try await sourceControlManager.push( remote: sourceControlManager.operationRemote?.name ?? nil, branch: sourceControlManager.operationBranch?.name ?? nil, - setUpstream: sourceControlManager.currentBranch?.upstream == nil + setUpstream: sourceControlManager.currentBranch?.upstream == nil, + force: sourceControlManager.operationForce, + tags: sourceControlManager.operationIncludeTags ) self.loading = false dismiss()