mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
feat(jira): allow branch name customization (#12850)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
parent
85c4941492
commit
5fd2059e5e
2 changed files with 41 additions and 18 deletions
|
|
@ -43,6 +43,22 @@ starting with "_": "MP-1234_fix_dashboard". In both these cases, the issue opene
|
|||
This is also checks if the prefix is in the name, and adds it if not, so: "MP-1234" opens the issue "MP-1234",
|
||||
"mp-1234" opens the issue "mp-1234", and "1234" opens the issue "MP-1234".
|
||||
|
||||
If your branch naming convention deviates, you can overwrite the jira_branch function to determine and echo the Jira issue key yourself.
|
||||
Define a function `jira_branch` after sourcing `oh-my-zsh.sh` in your `.zshrc`.
|
||||
Example:
|
||||
```zsh
|
||||
# Determine branch name from naming convention 'type/KEY-123/description'.
|
||||
function jira_branch() {
|
||||
# Get name of the branch
|
||||
issue_arg=$(git rev-parse --abbrev-ref HEAD)
|
||||
# Strip prefixes like feature/ or bugfix/
|
||||
issue_arg=${issue_arg#*/}
|
||||
# Strip suffixes like /some-branch-description
|
||||
issue_arg=${issue_arg%%/*}
|
||||
# Return the value
|
||||
echo $issue_arg
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### Debugging usage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue