@@ -31,6 +31,9 @@ type MergeOptions struct {
3131 DeleteBranch bool
3232 MergeMethod api.PullRequestMergeMethod
3333
34+ Body string
35+ BodyChanged bool
36+
3437 IsDeleteBranchIndicated bool
3538 CanDeleteLocalBranch bool
3639 InteractiveMode bool
@@ -95,6 +98,8 @@ func NewCmdMerge(f *cmdutil.Factory, runF func(*MergeOptions) error) *cobra.Comm
9598 opts .IsDeleteBranchIndicated = cmd .Flags ().Changed ("delete-branch" )
9699 opts .CanDeleteLocalBranch = ! cmd .Flags ().Changed ("repo" )
97100
101+ opts .BodyChanged = cmd .Flags ().Changed ("body" )
102+
98103 if runF != nil {
99104 return runF (opts )
100105 }
@@ -103,6 +108,7 @@ func NewCmdMerge(f *cmdutil.Factory, runF func(*MergeOptions) error) *cobra.Comm
103108 }
104109
105110 cmd .Flags ().BoolVarP (& opts .DeleteBranch , "delete-branch" , "d" , false , "Delete the local and remote branch after merge" )
111+ cmd .Flags ().StringVarP (& opts .Body , "body" , "b" , "" , "Body for merge commit" )
106112 cmd .Flags ().BoolVarP (& flagMerge , "merge" , "m" , false , "Merge the commits with the base branch" )
107113 cmd .Flags ().BoolVarP (& flagRebase , "rebase" , "r" , false , "Rebase the commits onto the base branch" )
108114 cmd .Flags ().BoolVarP (& flagSquash , "squash" , "s" , false , "Squash the commits into one commit and merge it into the base branch" )
@@ -147,7 +153,12 @@ func mergeRun(opts *MergeOptions) error {
147153 }
148154 }
149155
150- err = api .PullRequestMerge (apiClient , baseRepo , pr , mergeMethod )
156+ var body * string = nil
157+ if opts .BodyChanged {
158+ body = & opts .Body
159+ }
160+
161+ err = api .PullRequestMerge (apiClient , baseRepo , pr , mergeMethod , body )
151162 if err != nil {
152163 return err
153164 }
0 commit comments