Skip to content

Commit fabbfe1

Browse files
Add flag for deleting branch
Co-Authored-By: Nate Smith <vilmibm@neongrid.space>
1 parent 9187efd commit fabbfe1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

command/pr.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func init() {
2828
prCmd.AddCommand(prCloseCmd)
2929
prCmd.AddCommand(prReopenCmd)
3030
prCmd.AddCommand(prMergeCmd)
31+
prMergeCmd.Flags().BoolP("delete", "d", true, "Delete the local branch after merge")
3132
prMergeCmd.Flags().BoolP("merge", "m", true, "Merge the commits with the base branch")
3233
prMergeCmd.Flags().BoolP("rebase", "r", false, "Rebase the commits onto the base branch")
3334
prMergeCmd.Flags().BoolP("squash", "s", false, "Squash the commits into one commit and merge it into the base branch")
@@ -473,7 +474,10 @@ func prMerge(cmd *cobra.Command, args []string) error {
473474
}
474475

475476
mergeMethod := api.PullRequestMergeMethodMerge
476-
deleteBranch := true
477+
deleteBranch, err := cmd.Flags().GetBool("delete")
478+
if err != nil {
479+
return nil
480+
}
477481

478482
isInteractive := !cmd.Flags().Changed("rebase") && !cmd.Flags().Changed("squash") && !cmd.Flags().Changed("merged")
479483
if isInteractive {

0 commit comments

Comments
 (0)