git-jira-shortcuts 1.0.12 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -1
- package/package.json +1 -1
- package/shell/git-extras.sh +46 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ The `init` command will walk you through configuration and add the necessary sou
|
|
|
26
26
|
|
|
27
27
|
## Configuration
|
|
28
28
|
|
|
29
|
-
Running `git-jira-shortcuts init` creates `~/.git-jira-shortcuts.env` with:
|
|
29
|
+
Running `git-jira-shortcuts init` creates `~/.git-jira-shortcuts.env` with your machine-wide settings:
|
|
30
30
|
|
|
31
31
|
| Variable | Required | Description |
|
|
32
32
|
|----------|----------|-------------|
|
|
@@ -34,6 +34,26 @@ Running `git-jira-shortcuts init` creates `~/.git-jira-shortcuts.env` with:
|
|
|
34
34
|
| `GJS_JIRA_DOMAIN` | Yes | Jira domain (e.g. `yourco.atlassian.net`) |
|
|
35
35
|
| `GJS_JIRA_API_TOKEN` | Yes | Base64-encoded Jira API token |
|
|
36
36
|
| `GJS_BRANCH_WEBHOOK_URL` | No | Optional webhook for branch name generation |
|
|
37
|
+
| `GJS_BRANCH_ALIASES` | No | Override `m`/`d` shorthand (e.g. `("m:main" "d:develop")`) |
|
|
38
|
+
|
|
39
|
+
### Per-repo config
|
|
40
|
+
|
|
41
|
+
Different repos can use different branch names (e.g. `main` vs `master`). Add a `.git-jira-shortcuts` file to any repo root to override your global settings for that repo:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# my-repo/.git-jira-shortcuts
|
|
45
|
+
GJS_BRANCH_ALIASES=("m:main" "d:develop")
|
|
46
|
+
GJS_TICKET_PREFIX=OTHERPROJ
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The file is sourced automatically when you `cd` into the repo, and your global settings are restored when you leave. Any `GJS_*` variable can be overridden this way.
|
|
50
|
+
|
|
51
|
+
You'll probably want to add this to your global gitignore so it doesn't get committed:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
echo ".git-jira-shortcuts" >> ~/.gitignore_global
|
|
55
|
+
git config --global core.excludesfile ~/.gitignore_global
|
|
56
|
+
```
|
|
37
57
|
|
|
38
58
|
### Generating your Jira API token
|
|
39
59
|
|
|
@@ -108,9 +128,24 @@ gc fix the bug # Commits as "PROJ-1234: fix the bug"
|
|
|
108
128
|
```
|
|
109
129
|
|
|
110
130
|
### Branch shorthand
|
|
131
|
+
By default:
|
|
111
132
|
- `m` → `master`
|
|
112
133
|
- `d` → `develop`
|
|
113
134
|
|
|
135
|
+
To customize these (e.g. if your repo uses `main` instead of `master`), set `GJS_BRANCH_ALIASES` in `~/.git-jira-shortcuts.env`:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
GJS_BRANCH_ALIASES=("m:main" "d:develop")
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
You can add as many aliases as you want:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
GJS_BRANCH_ALIASES=("m:main" "d:dev" "s:staging")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
When `GJS_BRANCH_ALIASES` is set, the defaults are replaced entirely — so include all the aliases you want.
|
|
148
|
+
|
|
114
149
|
## Update
|
|
115
150
|
|
|
116
151
|
```bash
|
package/package.json
CHANGED
package/shell/git-extras.sh
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# git-jira-shortcuts — Git + Jira workflow shortcuts for zsh
|
|
3
3
|
# https://github.com/chipallen2/git-jira-shortcuts
|
|
4
4
|
#
|
|
5
|
-
#
|
|
5
|
+
# Global configuration (set in ~/.git-jira-shortcuts.env):
|
|
6
6
|
# GJS_TICKET_PREFIX — Jira project key (e.g. MYPROJ, ACME)
|
|
7
7
|
# GJS_JIRA_DOMAIN — Jira domain (e.g. yourco.atlassian.net)
|
|
8
8
|
# GJS_JIRA_API_TOKEN — Base64 Jira API token
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
# GJS_REPOS — Optional array of repo paths for grepos
|
|
11
11
|
# GJS_CLEAN_PROTECTED — Optional array of branch names to never delete with gclean
|
|
12
12
|
# GJS_BRANCH_ALIASES — Optional array of branch aliases (e.g. "m:master" "d:develop")
|
|
13
|
+
#
|
|
14
|
+
# Per-repo overrides (set in <repo-root>/.git-jira-shortcuts):
|
|
15
|
+
# Same variables as above — auto-loaded on cd, reset to global on leave.
|
|
16
|
+
# Example: GJS_BRANCH_ALIASES=("m:main" "d:develop")
|
|
13
17
|
|
|
14
18
|
# Store path to this script for self-reference (used by ghelp)
|
|
15
19
|
GJS_SHELL_SCRIPT_PATH="${0:A}"
|
|
@@ -43,6 +47,45 @@ _gjs_check_upgrade() {
|
|
|
43
47
|
fi
|
|
44
48
|
}
|
|
45
49
|
|
|
50
|
+
###
|
|
51
|
+
### PER-REPO CONFIG
|
|
52
|
+
###
|
|
53
|
+
|
|
54
|
+
# Snapshot global values (from ~/.git-jira-shortcuts.env) so they can be
|
|
55
|
+
# restored when leaving a repo that has local overrides.
|
|
56
|
+
_GJS_GLOBAL_TICKET_PREFIX="${GJS_TICKET_PREFIX:-}"
|
|
57
|
+
_GJS_GLOBAL_BRANCH_WEBHOOK_URL="${GJS_BRANCH_WEBHOOK_URL:-}"
|
|
58
|
+
if [[ -n "${GJS_BRANCH_ALIASES+x}" ]]; then
|
|
59
|
+
_GJS_GLOBAL_BRANCH_ALIASES=("${GJS_BRANCH_ALIASES[@]}")
|
|
60
|
+
_GJS_GLOBAL_BRANCH_ALIASES_ISSET=1
|
|
61
|
+
else
|
|
62
|
+
_GJS_GLOBAL_BRANCH_ALIASES=()
|
|
63
|
+
_GJS_GLOBAL_BRANCH_ALIASES_ISSET=0
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
# Load .git-jira-shortcuts from the current repo root (if present),
|
|
67
|
+
# overriding global values. Resets to globals first so leaving a repo
|
|
68
|
+
# with local overrides cleanly reverts to the machine-wide config.
|
|
69
|
+
_gjs_apply_repo_config() {
|
|
70
|
+
GJS_TICKET_PREFIX="$_GJS_GLOBAL_TICKET_PREFIX"
|
|
71
|
+
GJS_BRANCH_WEBHOOK_URL="$_GJS_GLOBAL_BRANCH_WEBHOOK_URL"
|
|
72
|
+
if [[ "$_GJS_GLOBAL_BRANCH_ALIASES_ISSET" -eq 1 ]]; then
|
|
73
|
+
GJS_BRANCH_ALIASES=("${_GJS_GLOBAL_BRANCH_ALIASES[@]}")
|
|
74
|
+
else
|
|
75
|
+
unset GJS_BRANCH_ALIASES
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
local git_root
|
|
79
|
+
git_root=$(git rev-parse --show-toplevel 2>/dev/null) || return 0
|
|
80
|
+
local rc_file="$git_root/.git-jira-shortcuts"
|
|
81
|
+
[[ -f "$rc_file" ]] && source "$rc_file"
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
# Auto-apply on directory change and immediately for the current directory.
|
|
85
|
+
autoload -U add-zsh-hook 2>/dev/null
|
|
86
|
+
add-zsh-hook chpwd _gjs_apply_repo_config
|
|
87
|
+
_gjs_apply_repo_config
|
|
88
|
+
|
|
46
89
|
###
|
|
47
90
|
### INTERNAL HELPERS
|
|
48
91
|
###
|
|
@@ -441,6 +484,7 @@ gdiff() { # gdiff [*branch=m] | List files changed for PR to target branch + Git
|
|
|
441
484
|
fi
|
|
442
485
|
}
|
|
443
486
|
|
|
487
|
+
unalias gpr 2>/dev/null
|
|
444
488
|
gpr() { # gpr [*branch=m] | Open GitHub compare URL from current branch to target branch
|
|
445
489
|
local target_input="${1:-m}"
|
|
446
490
|
local target
|
|
@@ -985,6 +1029,7 @@ testJira() { # testJira | Test Jira API connection
|
|
|
985
1029
|
}
|
|
986
1030
|
alias tj='testJira' # testJira | Test Jira API connection
|
|
987
1031
|
|
|
1032
|
+
unalias gclean 2>/dev/null
|
|
988
1033
|
gclean() { # gclean [--dry-run] | Delete local branches already merged to master (skips recent)
|
|
989
1034
|
local dry_run=0
|
|
990
1035
|
|