Skip to main content

Command Palette

Search for a command to run...

Understanding GitLab's Squash Commit Options

Published
2 min read
Understanding GitLab's Squash Commit Options

Introduction

GitLab allows project maintainers to control the default behavior of commit squashing during merge requests. These settings are found in your project's Settings > Merge requests and under the "Squash commits when merging" section. The available options are:

  • Do not allow:

    Squashing is entirely disabled, and the "Squash commits" checkbox will not appear in merge requests.

  • Allow:

    Squashing is off by default, but users can choose to enable it by checking the "Squash commits" box.

  • Encourage:

    Squashing is on by default, but users can choose to disable it.

  • Require:

    Squashing is always performed, and the "Squash commits" checkbox will be selected and unchangeable.

Troubleshooting a Disabled Squash Option:

  • Check Project Settings:

    • Navigate to your project in GitLab.
    • Go to Settings > Merge requests.
    • Locate the "Squash commits when merging" section.
    • Verify the selected option. If it's set to "Do not allow" or "Require," this explains why the option is disabled or always on.
  • Request Project Maintainer to Change Settings (if necessary):

    • If you require the ability to squash commits and the project settings are preventing it, you will need to request a project maintainer or owner to adjust the "Squash commits when merging" setting to "Allow" or "Encourage."

Conclusion

By understanding and adjusting these project-level settings, you can control the availability and default behavior of squash commits in your GitLab merge requests.

More from this blog

Cloud Tuned

729 posts

Your starting point for anything cloud: AWS, Azure, GCP, Serverless, Architecture, Hybrid Cloud, Systems Design and other Information Technology topics.