You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This implementation, unlike that proposed in #4253
keeps the yaml schema easy, and does a migration from the single
elements to a sequence of elements.
Copy file name to clipboardExpand all lines: docs/Config.md
+20-15Lines changed: 20 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -341,14 +341,6 @@ git:
341
341
# If true, do not allow force pushes
342
342
disableForcePushing: false
343
343
344
-
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
345
-
commitPrefix:
346
-
# pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use "^\\w+\\/(\\w+-\\w+).*"
347
-
pattern: ""
348
-
349
-
# Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] "
350
-
replace: ""
351
-
352
344
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-branch-name-prefix
353
345
branchPrefix: ""
354
346
@@ -922,27 +914,40 @@ Where:
922
914
## Predefined commit message prefix
923
915
924
916
In situations where certain naming pattern is used for branches and commits, pattern can be used to populate commit message with prefix that is parsed from the branch name.
917
+
If you define multiple naming patterns, they will be attempted in order until one matches.
925
918
926
-
Example:
919
+
Example hitting first match:
927
920
928
921
- Branch name: feature/AB-123
929
-
- Commit message: [AB-123] Adding feature
922
+
- Generated commit message prefix: [AB-123]
923
+
924
+
Example hitting second match:
925
+
926
+
- Branch name: CD-456_fix_problem
927
+
- Generated commit message prefix: (CD-456)
930
928
931
929
```yaml
932
930
git:
933
931
commitPrefix:
934
-
pattern: "^\\w+\\/(\\w+-\\w+).*"
935
-
replace: '[$1] '
932
+
- pattern: "^\\w+\\/(\\w+-\\w+).*"
933
+
replace: '[$1] '
934
+
- pattern: "^([^_]+)_.*" # Take all text prior to the first underscore
935
+
replace: '($1) '
936
936
```
937
937
938
-
If you want repository-specific prefixes, you can map them with `commitPrefixes`. If you have both `commitPrefixes` defined and an entry in `commitPrefixes` for the current repo, the `commitPrefixes` entry is given higher precedence. Repository folder names must be an exact match.
938
+
If you want repository-specific prefixes, you can map them with `commitPrefixes`. If you have both entries in `commitPrefix` defined and an repository match in `commitPrefixes` for the current repo, the `commitPrefixes` entries will be attempted first. Repository folder names must be an exact match.
939
939
940
940
```yaml
941
941
git:
942
942
commitPrefixes:
943
943
my_project: # This is repository folder name
944
-
pattern: "^\\w+\\/(\\w+-\\w+).*"
945
-
replace: '[$1] '
944
+
- pattern: "^\\w+\\/(\\w+-\\w+).*"
945
+
replace: '[$1] '
946
+
commitPrefix:
947
+
- pattern: "^(\\w+)-.*" # A more general match for any leading word
948
+
replace : '[$1] '
949
+
- pattern: ".*" # The final fallthrough regex that copies over the whole branch name
0 commit comments