jesseduffield / lazygit

simple terminal UI for git commands
MIT License
52.99k stars 1.85k forks source link

Commitizen integration #41

Closed jukefr closed 3 years ago

jukefr commented 6 years ago

It would be nice to have commitizen integration, or a similar feature that allows you to use predefined commit messages.

For reference :

jesseduffield commented 4 years ago

I'm thinking we could have a flag in the config that, when enabled, will use git cz over git commit, and unconditionally switch to a subprocess so that you can fill out the prompt. There's work in the gocui repo to enable showing the cz prompts inside of lazygit but it might take some time to properly get that over the line

jesseduffield commented 3 years ago

I've added this as a custom command in the Custom Commands Compendium, as a replacement for the default git commit behaviour upon pressing shift+c in the files panel.

There are quite a few upvotes on this one so if anybody had something different in mind, or thinks that this should work out of the box with lazygit, do let me know!

I'll close this ticket for now :)

ceuk commented 3 years ago

Great solution IMO

rogerioefonseca commented 2 years ago

Great solution IMO

Working nicely here, thanks @ceuk

Cronos87 commented 3 months ago

I don't know if it's the place, but I wrote a simple command to have everything inside lazygit.

It could be enhanced; I wrote it down quickly for testing purposes 😊

Textes and style copied from vivaxy's extension (yeah, testing purposes…)

https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits

customCommands:
  - key: "C"
    command: 'git commit -m "{{ .Form.Type }}{{if .Form.Scopes}}({{ .Form.Scopes }}){{end}}: {{ .Form.Description }}"'
    description: "commit with commitizen"
    context: "files"
    prompts:
      - type: "menu"
        title: "Select the type of change you are committing."
        key: "Type"
        options:
          - name: "Feature"
            description: "a new feature"
            value: "feat"
          - name: "Fix"
            description: "a bug fix"
            value: "fix"
          - name: "Documentation"
            description: "Documentation only changes"
            value: "docs"
          - name: "Styles"
            description: "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)"
            value: "style"
          - name: "Code Refactoring"
            description: "A code change that neither fixes a bug nor adds a feature"
            value: "refactor"
          - name: "Performance Improvements"
            description: "A code change that improves performance"
            value: "perf"
          - name: "Tests"
            description: "Adding missing tests or correcting existing tests"
            value: "test"
          - name: "Builds"
            description: "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)"
            value: "build"
          - name: "Continuous Integration"
            description: "Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)"
            value: "ci"
          - name: "Chores"
            description: "Other changes that don't modify src or test files"
            value: "chore"
          - name: "Reverts"
            description: "Reverts a previous commit"
            value: "revert"
      - type: "input"
        title: "Enter the scope(s) of this change."
        key: "Scopes"
      - type: "input"
        title: "Enter the short description of the change."
        key: "Description"
      - type: "confirm"
        title: "Is the commit message correct?"
        body: "{{ .Form.Type }}{{if .Form.Scopes}}({{ .Form.Scopes }}){{end}}: {{ .Form.Description }}"