diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs index 08137f1cf..6712b40aa 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs @@ -440,6 +440,23 @@ private void OnCreateGUI() // Create button if (mode == BranchesMode.Default) { + // If the current branch is selected, then do not enable the Delete button + var disableDelete = activeBranchNode == selectedNode; + EditorGUI.BeginDisabledGroup(disableDelete); + { + if (GUILayout.Button("Delete", EditorStyles.miniButton, GUILayout.ExpandWidth(false))) + { + var selectedBranchName = selectedNode.Name; + var dialogTitle = "Delete Branch: " + selectedBranchName; + var dialogMessage = "Are you sure you want to delete the branch: " + selectedBranchName + "?"; + if (EditorUtility.DisplayDialog("Delete Branch?", dialogMessage, "Delete", "Cancel")) + { + GitClient.DeleteBranch(selectedBranchName, true).Start(); + } + } + } + EditorGUI.EndDisabledGroup(); + GUILayout.FlexibleSpace(); if (GUILayout.Button(CreateBranchButton, EditorStyles.miniButton, GUILayout.ExpandWidth(false))) {