X_AJ_X

lazygit config.yml

Dec 21st, 2025
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 4.94 KB | None | 0 0
  1. customCommands:
  2.   - key: "C"
  3.     command: |
  4.       git commit -m "{{ .Form.Type }}{{if .Form.Scopes}}({{ .Form.Scopes }}){{end}}: {{ .Form.Description }}" \
  5.      {{- if .Form.LongDescription }}
  6.      -m "{{ .Form.LongDescription }}" \
  7.      {{- end }}
  8.      {{- if .Form.BreakingChange }}
  9.      -m "BREAKING CHANGE: {{ .Form.BreakingChange }}"
  10.      {{- end }}
  11.    description: "commit with commitizen"
  12.    context: "files"
  13.    prompts:
  14.      - type: "menu"
  15.        title: "Select the type of change you are committing."
  16.        key: "Type"
  17.        options:
  18.          - name: "Feature m"
  19.            description: "a new feature"
  20.            value: "feat"
  21.          - name: "Fix p"
  22.            description: "a bug fix"
  23.            value: "fix"
  24.          - name: "Documentation p"
  25.            description: "Documentation only changes"
  26.            value: "docs"
  27.          - name: "Styles"
  28.            description: "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)"
  29.            value: "style"
  30.          - name: "Code Refactoring p"
  31.            description: "A code change that neither fixes a bug nor adds a feature"
  32.            value: "refactor"
  33.          - name: "Performance Improvements p"
  34.            description: "A code change that improves performance"
  35.            value: "perf"
  36.          - name: "Tests"
  37.            description: "Adding missing tests or correcting existing tests"
  38.            value: "test"
  39.          - name: "Builds"
  40.            description: "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)"
  41.            value: "build"
  42.          - name: "Continuous Integration"
  43.            description: "Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)"
  44.            value: "ci"
  45.          - name: "Chores p"
  46.            description: "Other changes that don't modify src or test files"
  47.            value: "chore"
  48.          - name: "Reverts"
  49.            description: "Reverts a previous commit"
  50.            value: "revert"
  51.      - type: "input"
  52.        title: "Enter the scope(s) of this change."
  53.        key: "Scopes"
  54.      - type: "input"
  55.        title: "Enter the short description of the change."
  56.        key: "Description"
  57.      - type: "input"
  58.        title: "Enter a more detailed description (optional)."
  59.        key: "LongDescription"
  60.      - type: "input"
  61.        title: "Describe the breaking change, if any (leave empty if none)."
  62.        key: "BreakingChange"
  63.      - type: "confirm"
  64.        title: "Is the commit message correct?"
  65.        body: |
  66.          {{ .Form.Type }}{{if .Form.Scopes}}({{ .Form.Scopes }}){{end}}: {{ .Form.Description }}
  67.          {{- if .Form.LongDescription }}
  68.  
  69.          {{ .Form.LongDescription }}
  70.          {{- end }}
  71.          {{- if .Form.BreakingChange }}
  72.  
  73.          BREAKING CHANGE: {{ .Form.BreakingChange }}
  74.          {{- end }}
  75.  - key: "B"
  76.    command: |
  77.      # Get the last commit message
  78.      LAST_COMMIT=$(git log -1 --pretty=%B)
  79.  
  80.      # Determine bump type based on commit message content
  81.      if echo "$LAST_COMMIT" | grep -q "BREAKING CHANGE"; then
  82.        echo "Major change detected."
  83.        bump major --no-commit;
  84.      elif echo "$LAST_COMMIT" | grep -q "^feat"; then
  85.        echo "Feature commit detected."
  86.        bump minor --no-commit;
  87.      elif echo "$LAST_COMMIT" | grep -q "^fix"; then
  88.        echo "Fix commit detected."
  89.        bump patch --no-commit;
  90.      elif echo "$LAST_COMMIT" | grep -q "^docs"; then
  91.        echo "Docs commit detected."
  92.        bump patch --no-commit;
  93.      elif echo "$LAST_COMMIT" | grep -q "^refactor"; then
  94.        echo "Refactor commit detected."
  95.        bump patch --no-commit;
  96.      elif echo "$LAST_COMMIT" | grep -q "^perf"; then
  97.        echo "Performance improvement detected."
  98.        bump patch --no-commit;
  99.      elif echo "$LAST_COMMIT" | grep -q "^chore"; then
  100.        echo "Chore commit detected."
  101.        bump patch --no-commit;
  102.      else
  103.        echo "Commit type does not require a version bump (e.g., style, test, build, ci, revert)."
  104.        exit 0;
  105.      fi
  106.  
  107.      # Add the updated version file to staging and amend the last commit
  108.      git add $(find lib -type f -name version.rb)
  109.      git commit --amend --no-edit
  110.  
  111.      # Get the new version number from the version file
  112.      new_version=$(bump current)
  113.      echo "Version bumped to ${new_version}"
  114.  
  115.      # Create an annotated Git tag for the new version and push it
  116.      git tag -a v${new_version} -m "Version ${new_version}"
  117.      git push origin v${new_version}
  118.    description: "Bump version based on last commit and push a git tag"
  119.    context: "global"
  120.  
  121. git:
  122.  paging:
  123.    colorArg: always
  124.    pager: delta --paging=never --line-numbers --hyperlinks --hyperlinks-file-link-format="lazygit-edit://{path}:{line}"
  125.  
  126.  
  127. os:
  128.  editPreset: "nvim-remote"
  129. gui:
  130.  nerdFontsVersion: "3"
Advertisement
Add Comment
Please, Sign In to add comment