gitbash 0.2.5 → 0.2.7
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/bin/gitbash +61 -0
- package/commands/_utils.sh +34 -0
- package/commands/branch.sh +9 -1
- package/commands/cleanstash.sh +14 -4
- package/commands/cleanup.sh +8 -6
- package/commands/commit.sh +10 -2
- package/commands/commits.sh +7 -2
- package/commands/create.sh +8 -3
- package/commands/stale.sh +10 -2
- package/commands/stashes.sh +9 -1
- package/commands/status.sh +12 -4
- package/commands/switch.sh +9 -1
- package/commands/unstash.sh +10 -2
- package/commands/update.sh +9 -1
- package/package.json +1 -1
package/bin/gitbash
CHANGED
|
@@ -19,6 +19,7 @@ configure_gitbash() {
|
|
|
19
19
|
local current_merge="${GITBASH_MERGE_COMMAND:-fork}"
|
|
20
20
|
|
|
21
21
|
echo "Configure gitbash (writes to $CONFIG_FILE)"
|
|
22
|
+
echo
|
|
22
23
|
|
|
23
24
|
local input prefix merge_cmd
|
|
24
25
|
|
|
@@ -36,7 +37,67 @@ GITBASH_FEATURE_BRANCH_PREFIX="$prefix"
|
|
|
36
37
|
GITBASH_MERGE_COMMAND="$merge_cmd"
|
|
37
38
|
EOF
|
|
38
39
|
|
|
40
|
+
echo
|
|
39
41
|
echo "Saved configuration to $CONFIG_FILE"
|
|
42
|
+
|
|
43
|
+
# Check for shell integration
|
|
44
|
+
check_shell_integration
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# Check if gitbash shell integration is set up
|
|
48
|
+
check_shell_integration() {
|
|
49
|
+
local shell_rc=""
|
|
50
|
+
local shell_files=("$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.bash_profile")
|
|
51
|
+
|
|
52
|
+
# Find the first existing shell rc file
|
|
53
|
+
for file in "${shell_files[@]}"; do
|
|
54
|
+
if [[ -f "$file" ]]; then
|
|
55
|
+
shell_rc="$file"
|
|
56
|
+
break
|
|
57
|
+
fi
|
|
58
|
+
done
|
|
59
|
+
|
|
60
|
+
if [[ -z "$shell_rc" ]]; then
|
|
61
|
+
echo
|
|
62
|
+
echo "No shell config file found (.zshrc, .bashrc, .bash_profile)"
|
|
63
|
+
return 0
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
# Check if gitbash integration already exists
|
|
67
|
+
local has_init=false
|
|
68
|
+
local has_alias=false
|
|
69
|
+
|
|
70
|
+
if grep -q 'eval.*gitbash --init' "$shell_rc" 2>/dev/null; then
|
|
71
|
+
has_init=true
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
if grep -q 'alias.*gitbash' "$shell_rc" 2>/dev/null; then
|
|
75
|
+
has_alias=true
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# If neither init nor alias found, offer to add
|
|
79
|
+
if [[ "$has_init" == false && "$has_alias" == false ]]; then
|
|
80
|
+
echo
|
|
81
|
+
echo "Shell integration not found in $shell_rc"
|
|
82
|
+
local add_init
|
|
83
|
+
read -e -p "Add 'eval \"\$(gitbash --init)\"' to $shell_rc? (Y/n): " add_init
|
|
84
|
+
case "$add_init" in
|
|
85
|
+
[nN][oO]|[nN])
|
|
86
|
+
echo "Skipped shell integration."
|
|
87
|
+
;;
|
|
88
|
+
*)
|
|
89
|
+
echo >> "$shell_rc"
|
|
90
|
+
echo '# gitbash shell integration' >> "$shell_rc"
|
|
91
|
+
echo 'eval "$(gitbash --init)"' >> "$shell_rc"
|
|
92
|
+
echo
|
|
93
|
+
echo "Added to $shell_rc"
|
|
94
|
+
echo "Run 'source $shell_rc' or restart your shell to activate."
|
|
95
|
+
;;
|
|
96
|
+
esac
|
|
97
|
+
else
|
|
98
|
+
echo
|
|
99
|
+
echo "Shell integration already configured in $shell_rc"
|
|
100
|
+
fi
|
|
40
101
|
}
|
|
41
102
|
|
|
42
103
|
# Resolve symlinks to get the actual script location
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck disable=SC2155
|
|
3
|
+
# Common utilities for gitbash commands - compatible with bash and zsh
|
|
4
|
+
|
|
5
|
+
# Portable read with prompt that works in both bash and zsh
|
|
6
|
+
# Usage: prompt_read "prompt text" variable_name
|
|
7
|
+
# The result is stored in the variable name provided
|
|
8
|
+
prompt_read() {
|
|
9
|
+
local prompt="$1"
|
|
10
|
+
local varname="$2"
|
|
11
|
+
|
|
12
|
+
if [[ -n "${ZSH_VERSION:-}" ]]; then
|
|
13
|
+
# zsh: use read with ?prompt syntax
|
|
14
|
+
read -r "${varname}?${prompt}"
|
|
15
|
+
else
|
|
16
|
+
# bash: use read -p
|
|
17
|
+
read -rp "$prompt" "$varname"
|
|
18
|
+
fi
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# Portable read with readline editing (for defaults)
|
|
22
|
+
# Usage: prompt_read_edit "prompt text" variable_name
|
|
23
|
+
prompt_read_edit() {
|
|
24
|
+
local prompt="$1"
|
|
25
|
+
local varname="$2"
|
|
26
|
+
|
|
27
|
+
if [[ -n "${ZSH_VERSION:-}" ]]; then
|
|
28
|
+
# zsh: use vared or read with ?prompt
|
|
29
|
+
read -r "${varname}?${prompt}"
|
|
30
|
+
else
|
|
31
|
+
# bash: use read -e -p
|
|
32
|
+
read -e -rp "$prompt" "$varname"
|
|
33
|
+
fi
|
|
34
|
+
}
|
package/commands/branch.sh
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck disable=SC2155
|
|
3
|
+
|
|
4
|
+
# Source common utilities
|
|
5
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
6
|
+
# shellcheck source=_utils.sh
|
|
7
|
+
source "$SOURCE_DIR/_utils.sh"
|
|
8
|
+
|
|
1
9
|
branch() {
|
|
2
10
|
# -----------------------------
|
|
3
11
|
# 0. Check for help/version flag
|
|
@@ -103,7 +111,7 @@ EOF
|
|
|
103
111
|
echo "fzf is not installed."
|
|
104
112
|
|
|
105
113
|
# Ask whether to install with Homebrew
|
|
106
|
-
|
|
114
|
+
prompt_read "Install fzf with Homebrew? (y/N): " ans
|
|
107
115
|
case "$ans" in
|
|
108
116
|
[yY][eE][sS]|[yY])
|
|
109
117
|
echo "Installing fzf with brew..."
|
package/commands/cleanstash.sh
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck disable=SC2155
|
|
3
|
+
|
|
4
|
+
# Source common utilities
|
|
5
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
6
|
+
# shellcheck source=_utils.sh
|
|
7
|
+
source "$SOURCE_DIR/_utils.sh"
|
|
8
|
+
|
|
1
9
|
cleanstash() {
|
|
2
10
|
# -----------------------------
|
|
3
11
|
# 0. Check for help/version flag
|
|
@@ -69,7 +77,7 @@ EOF
|
|
|
69
77
|
echo "fzf is not installed."
|
|
70
78
|
|
|
71
79
|
# Ask whether to install with Homebrew
|
|
72
|
-
|
|
80
|
+
prompt_read "Install fzf with Homebrew? (y/N): " ans
|
|
73
81
|
case "$ans" in
|
|
74
82
|
[yY][eE][sS]|[yY])
|
|
75
83
|
echo "Installing fzf with brew..."
|
|
@@ -164,7 +172,7 @@ EOF
|
|
|
164
172
|
done
|
|
165
173
|
echo
|
|
166
174
|
|
|
167
|
-
|
|
175
|
+
prompt_read "Delete these ${#stash_ids[@]} stash(es)? (y/N): " confirm_ans
|
|
168
176
|
case "$confirm_ans" in
|
|
169
177
|
[yY][eE][sS]|[yY])
|
|
170
178
|
# -----------------------------
|
|
@@ -172,8 +180,10 @@ EOF
|
|
|
172
180
|
# -----------------------------
|
|
173
181
|
echo "Deleting stashes..."
|
|
174
182
|
# Sort by stash number in descending order to delete safely
|
|
175
|
-
local sorted_ids
|
|
176
|
-
|
|
183
|
+
local sorted_ids=()
|
|
184
|
+
while IFS= read -r id; do
|
|
185
|
+
sorted_ids+=("$id")
|
|
186
|
+
done < <(printf '%s\n' "${stash_ids[@]}" | sort -t'{' -k2 -rn)
|
|
177
187
|
|
|
178
188
|
for stash_id in "${sorted_ids[@]}"; do
|
|
179
189
|
echo "Dropping $stash_id ..."
|
package/commands/cleanup.sh
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# shellcheck disable=SC2155
|
|
3
3
|
|
|
4
|
+
# Source common utilities
|
|
5
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
6
|
+
# shellcheck source=_utils.sh
|
|
7
|
+
source "$SOURCE_DIR/_utils.sh"
|
|
8
|
+
|
|
4
9
|
# Cleanup local branches that are no longer needed
|
|
5
10
|
cleanup() {
|
|
6
11
|
# -----------------------------
|
|
@@ -85,7 +90,7 @@ EOF
|
|
|
85
90
|
if [[ "$json_mode" == false ]]; then
|
|
86
91
|
if ! command -v fzf >/dev/null 2>&1; then
|
|
87
92
|
echo "fzf is not installed."
|
|
88
|
-
|
|
93
|
+
prompt_read "Install fzf with Homebrew? (y/N): " ans
|
|
89
94
|
case "$ans" in
|
|
90
95
|
[yY][eE][sS]|[yY])
|
|
91
96
|
echo "Installing fzf with brew..."
|
|
@@ -106,9 +111,6 @@ EOF
|
|
|
106
111
|
# -----------------------------
|
|
107
112
|
# 2. Fetch and prune to sync with remote
|
|
108
113
|
# -----------------------------
|
|
109
|
-
if [[ "$json_mode" == false ]]; then
|
|
110
|
-
echo "Fetching and pruning remote..."
|
|
111
|
-
fi
|
|
112
114
|
if ! git fetch --prune origin 2>/dev/null; then
|
|
113
115
|
if [[ "$json_mode" == false ]]; then
|
|
114
116
|
echo "⚠ Fetch failed; continuing with local data." >&2
|
|
@@ -459,7 +461,7 @@ Found $total_count branches ($preselect_count pre-selected for deletion)" \
|
|
|
459
461
|
# Default to Y if only merged branches, otherwise N
|
|
460
462
|
local confirm
|
|
461
463
|
if [[ "$only_merged" == true ]]; then
|
|
462
|
-
|
|
464
|
+
prompt_read "Delete these ${#branches_to_delete[@]} local branch(es)? (Y/n): " confirm
|
|
463
465
|
case "$confirm" in
|
|
464
466
|
[nN][oO]|[nN])
|
|
465
467
|
echo "Deletion cancelled."
|
|
@@ -467,7 +469,7 @@ Found $total_count branches ($preselect_count pre-selected for deletion)" \
|
|
|
467
469
|
;;
|
|
468
470
|
esac
|
|
469
471
|
else
|
|
470
|
-
|
|
472
|
+
prompt_read "Delete these ${#branches_to_delete[@]} local branch(es)? (y/N): " confirm
|
|
471
473
|
case "$confirm" in
|
|
472
474
|
[yY][eE][sS]|[yY])
|
|
473
475
|
;;
|
package/commands/commit.sh
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck disable=SC2155
|
|
3
|
+
|
|
4
|
+
# Source common utilities
|
|
5
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
6
|
+
# shellcheck source=_utils.sh
|
|
7
|
+
source "$SOURCE_DIR/_utils.sh"
|
|
8
|
+
|
|
1
9
|
# Stage all changes and commit with a message.
|
|
2
10
|
# If no commit message argument is given, prompt the user for one.
|
|
3
11
|
commit() {
|
|
@@ -84,7 +92,7 @@ EOF
|
|
|
84
92
|
# If no commit message was provided...
|
|
85
93
|
if [ -z "$msg" ]; then
|
|
86
94
|
# Prompt the user for a commit message (no newline, no extra spaces)
|
|
87
|
-
|
|
95
|
+
prompt_read "Commit message: " msg
|
|
88
96
|
fi
|
|
89
97
|
|
|
90
98
|
# Check if there are staged changes
|
|
@@ -107,7 +115,7 @@ EOF
|
|
|
107
115
|
echo
|
|
108
116
|
echo "You have both staged and unstaged changes."
|
|
109
117
|
echo
|
|
110
|
-
|
|
118
|
+
prompt_read "Commit [s]taged only, or [a]ll changes? (s/a): " commit_choice
|
|
111
119
|
|
|
112
120
|
case "$commit_choice" in
|
|
113
121
|
[sS])
|
package/commands/commits.sh
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# shellcheck disable=SC2155
|
|
3
3
|
|
|
4
|
+
# Source common utilities
|
|
5
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
6
|
+
# shellcheck source=_utils.sh
|
|
7
|
+
source "$SOURCE_DIR/_utils.sh"
|
|
8
|
+
|
|
4
9
|
# List recent commits and optionally revert selected ones
|
|
5
10
|
commits() {
|
|
6
11
|
# -----------------------------
|
|
@@ -57,7 +62,7 @@ EOF
|
|
|
57
62
|
|
|
58
63
|
if ! command -v fzf >/dev/null 2>&1; then
|
|
59
64
|
echo "fzf is not installed."
|
|
60
|
-
|
|
65
|
+
prompt_read "Install fzf with Homebrew? (y/N): " ans
|
|
61
66
|
case "$ans" in
|
|
62
67
|
[yY][eE][sS]|[yY])
|
|
63
68
|
echo "Installing fzf with brew..."
|
|
@@ -185,7 +190,7 @@ Showing last $count commits" \
|
|
|
185
190
|
echo ""
|
|
186
191
|
|
|
187
192
|
local confirm
|
|
188
|
-
|
|
193
|
+
prompt_read "Revert these ${#commits_to_revert[@]} commit(s)? (y/N): " confirm
|
|
189
194
|
case "$confirm" in
|
|
190
195
|
[yY][eE][sS]|[yY])
|
|
191
196
|
echo "Reverting commits..."
|
package/commands/create.sh
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# shellcheck disable=SC2155
|
|
3
3
|
|
|
4
|
+
# Source common utilities
|
|
5
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
6
|
+
# shellcheck source=_utils.sh
|
|
7
|
+
source "$SOURCE_DIR/_utils.sh"
|
|
8
|
+
|
|
4
9
|
create() {
|
|
5
10
|
# -----------------------------
|
|
6
11
|
# 0. Check for help/version flag
|
|
@@ -71,7 +76,7 @@ EOF
|
|
|
71
76
|
else
|
|
72
77
|
# Interactive mode
|
|
73
78
|
echo "Enter Jira link (e.g., https://jira.company.com/browse/PROJ-123):"
|
|
74
|
-
|
|
79
|
+
prompt_read " > " jira_link
|
|
75
80
|
fi
|
|
76
81
|
|
|
77
82
|
if [[ -z "$jira_link" ]]; then
|
|
@@ -112,7 +117,7 @@ EOF
|
|
|
112
117
|
# -----------------------------
|
|
113
118
|
if [[ -z "$branch_title" ]]; then
|
|
114
119
|
echo "Enter branch title (will be converted to lowercase with dashes):"
|
|
115
|
-
|
|
120
|
+
prompt_read " > " branch_title
|
|
116
121
|
fi
|
|
117
122
|
|
|
118
123
|
if [[ -z "$branch_title" ]]; then
|
|
@@ -138,7 +143,7 @@ EOF
|
|
|
138
143
|
# -----------------------------
|
|
139
144
|
if git show-ref --verify --quiet "refs/heads/$branch_name"; then
|
|
140
145
|
echo "⚠ Branch '$branch_name' already exists locally."
|
|
141
|
-
|
|
146
|
+
prompt_read "Switch to this branch instead? (Y/n): " ans
|
|
142
147
|
case "$ans" in
|
|
143
148
|
[nN][oO]|[nN])
|
|
144
149
|
echo "Aborted."
|
package/commands/stale.sh
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck disable=SC2155
|
|
3
|
+
|
|
4
|
+
# Source common utilities
|
|
5
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
6
|
+
# shellcheck source=_utils.sh
|
|
7
|
+
source "$SOURCE_DIR/_utils.sh"
|
|
8
|
+
|
|
1
9
|
stale() {
|
|
2
10
|
# -----------------------------
|
|
3
11
|
# 0. Check for help/version flag and parse options
|
|
@@ -103,7 +111,7 @@ EOF
|
|
|
103
111
|
if ! command -v fzf >/dev/null 2>&1; then
|
|
104
112
|
echo "fzf is not installed."
|
|
105
113
|
|
|
106
|
-
|
|
114
|
+
prompt_read "Install fzf with Homebrew? (y/N): " ans
|
|
107
115
|
case "$ans" in
|
|
108
116
|
[yY][eE][sS]|[yY])
|
|
109
117
|
echo "Installing fzf with brew..."
|
|
@@ -392,7 +400,7 @@ Showing $stale_count stale branches (older than 3 months)" \
|
|
|
392
400
|
done
|
|
393
401
|
echo ""
|
|
394
402
|
|
|
395
|
-
|
|
403
|
+
prompt_read "Delete these ${#branches_to_delete[@]} branch(es) from remote? (y/N): " confirm
|
|
396
404
|
case "$confirm" in
|
|
397
405
|
[yY][eE][sS]|[yY])
|
|
398
406
|
echo "Deleting branches..."
|
package/commands/stashes.sh
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck disable=SC2155
|
|
3
|
+
|
|
4
|
+
# Source common utilities
|
|
5
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
6
|
+
# shellcheck source=_utils.sh
|
|
7
|
+
source "$SOURCE_DIR/_utils.sh"
|
|
8
|
+
|
|
1
9
|
stashes() {
|
|
2
10
|
# -----------------------------
|
|
3
11
|
# 0. Check for help/version flag
|
|
@@ -102,7 +110,7 @@ EOF
|
|
|
102
110
|
echo "fzf is not installed."
|
|
103
111
|
|
|
104
112
|
# Ask whether to install with Homebrew
|
|
105
|
-
|
|
113
|
+
prompt_read "Install fzf with Homebrew? (y/N): " ans
|
|
106
114
|
case "$ans" in
|
|
107
115
|
[yY][eE][sS]|[yY])
|
|
108
116
|
echo "Installing fzf with brew..."
|
package/commands/status.sh
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck disable=SC2155
|
|
3
|
+
|
|
4
|
+
# Source common utilities
|
|
5
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
6
|
+
# shellcheck source=_utils.sh
|
|
7
|
+
source "$SOURCE_DIR/_utils.sh"
|
|
8
|
+
|
|
1
9
|
# Show git status with fzf file selector and diff preview
|
|
2
10
|
status() {
|
|
3
11
|
# -----------------------------
|
|
@@ -75,7 +83,7 @@ EOF
|
|
|
75
83
|
echo "fzf is not installed."
|
|
76
84
|
|
|
77
85
|
# Ask whether to install with Homebrew
|
|
78
|
-
|
|
86
|
+
prompt_read "Install fzf with Homebrew? (y/N): " ans
|
|
79
87
|
case "$ans" in
|
|
80
88
|
[yY][eE][sS]|[yY])
|
|
81
89
|
echo "Installing fzf with brew..."
|
|
@@ -212,7 +220,7 @@ EOF
|
|
|
212
220
|
for f in "${untracked_to_delete[@]}"; do
|
|
213
221
|
echo " - $f"
|
|
214
222
|
done
|
|
215
|
-
|
|
223
|
+
prompt_read "Delete these ${#untracked_to_delete[@]} untracked file(s)? (y/N): " confirm
|
|
216
224
|
case "$confirm" in
|
|
217
225
|
[yY][eE][sS]|[yY])
|
|
218
226
|
for f in "${untracked_to_delete[@]}"; do
|
|
@@ -232,7 +240,7 @@ EOF
|
|
|
232
240
|
for f in "${files_to_revert[@]}"; do
|
|
233
241
|
echo " - $f"
|
|
234
242
|
done
|
|
235
|
-
|
|
243
|
+
prompt_read "Revert changes in these ${#files_to_revert[@]} file(s)? This cannot be undone. (y/N): " confirm
|
|
236
244
|
case "$confirm" in
|
|
237
245
|
[yY][eE][sS]|[yY])
|
|
238
246
|
for f in "${files_to_revert[@]}"; do
|
|
@@ -312,7 +320,7 @@ EOF
|
|
|
312
320
|
done
|
|
313
321
|
|
|
314
322
|
echo
|
|
315
|
-
|
|
323
|
+
prompt_read "Would you like to commit and push these changes? (Y/n): " ans
|
|
316
324
|
case "$ans" in
|
|
317
325
|
[nN][oO]|[nN])
|
|
318
326
|
echo "Continuing..."
|
package/commands/switch.sh
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck disable=SC2155
|
|
3
|
+
|
|
4
|
+
# Source common utilities
|
|
5
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
6
|
+
# shellcheck source=_utils.sh
|
|
7
|
+
source "$SOURCE_DIR/_utils.sh"
|
|
8
|
+
|
|
1
9
|
# Select and switch to a branch using fzf
|
|
2
10
|
switch() {
|
|
3
11
|
# -----------------------------
|
|
@@ -60,7 +68,7 @@ EOF
|
|
|
60
68
|
echo "fzf is not installed."
|
|
61
69
|
|
|
62
70
|
# Ask whether to install with Homebrew
|
|
63
|
-
|
|
71
|
+
prompt_read "Install fzf with Homebrew? (y/N): " ans
|
|
64
72
|
case "$ans" in
|
|
65
73
|
[yY][eE][sS]|[yY])
|
|
66
74
|
echo "Installing fzf with brew..."
|
package/commands/unstash.sh
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck disable=SC2155
|
|
3
|
+
|
|
4
|
+
# Source common utilities
|
|
5
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
6
|
+
# shellcheck source=_utils.sh
|
|
7
|
+
source "$SOURCE_DIR/_utils.sh"
|
|
8
|
+
|
|
1
9
|
unstash() {
|
|
2
10
|
# -----------------------------
|
|
3
11
|
# 0. Check for help/version flag
|
|
@@ -72,7 +80,7 @@ EOF
|
|
|
72
80
|
echo "fzf is not installed."
|
|
73
81
|
|
|
74
82
|
# Ask whether to install with Homebrew
|
|
75
|
-
|
|
83
|
+
prompt_read "Install fzf with Homebrew? (y/N): " ans
|
|
76
84
|
case "$ans" in
|
|
77
85
|
[yY][eE][sS]|[yY])
|
|
78
86
|
echo "Installing fzf with brew..."
|
|
@@ -165,7 +173,7 @@ EOF
|
|
|
165
173
|
# 6. Confirm before dropping
|
|
166
174
|
# -----------------------------
|
|
167
175
|
echo
|
|
168
|
-
|
|
176
|
+
prompt_read "Drop $stash_id now? (y/N): " drop_ans
|
|
169
177
|
case "$drop_ans" in
|
|
170
178
|
[yY][eE][sS]|[yY])
|
|
171
179
|
echo "Dropping $stash_id ..."
|
package/commands/update.sh
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck disable=SC2155
|
|
3
|
+
|
|
4
|
+
# Source common utilities
|
|
5
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
6
|
+
# shellcheck source=_utils.sh
|
|
7
|
+
source "$SOURCE_DIR/_utils.sh"
|
|
8
|
+
|
|
1
9
|
# Update the current branch with the latest version of master/main
|
|
2
10
|
update() {
|
|
3
11
|
local merge_tool="${GITBASH_FEATURE_BRANCH_PREFIX:-}"
|
|
@@ -122,7 +130,7 @@ EOF
|
|
|
122
130
|
echo "You have uncommitted changes:"
|
|
123
131
|
git status --short
|
|
124
132
|
echo ""
|
|
125
|
-
|
|
133
|
+
prompt_read "Commit changes before updating? (Y/n): " reply
|
|
126
134
|
if [[ "$reply" =~ ^[Nn]$ ]]; then
|
|
127
135
|
echo "⚠ Cannot merge with uncommitted changes. Commit or stash them first."
|
|
128
136
|
return 1
|