Config settings for squash-before-merge and remove-source-branch when creating MRs

Problem to solve

As an MR author, I want to configure the default merge behavior for squashing and removing source branch of my MRs so that I don't have to remember or retype the same cli options every time.

Proposal

2 proposals that could be done separately or together:

  1. Add options in the interactive flow when using glab mr create for squash-before-merge and remove-source-branch. Ideally these would take the repo's settings by default just like the web UI.
  2. Add config settings for turning on squash-before-merge and remove-source-branch by default with glab mr create. Perhaps we would also need to add command line flags to turn OFF these features if they are on because of config.

Further details

Interactive flow:

$ glab mr create                                                                                                                                                                                                      
? Choose a template Open a blank merge request
? Title: DEV-1485 Add initial dependencies for PoC
? Description <Received>
? What's next? Squash before merge
? What's next? Remove source branch
? What's next? Submit

Sample proposed config.yml

# control default behavior of commands
default-flags:
  mr:
    create:
      squash-before-merge: false
      remove-source-branch: true

Links / references

Assignee Loading
Time tracking Loading