|
7 | 7 | # `./git_sync.sh push` – updates remote/master with changes from current branch |
8 | 8 | ## |
9 | 9 |
|
10 | | -FORMAT_ITALIC="\033[3m" |
11 | | -FORMAT_RED="\033[31m" |
12 | | -FORMAT_GREEN="\033[32m" |
13 | | -FORMAT_YELLOW="\033[33m" |
14 | | -FORMAT_RESET="\033[0m" |
| 10 | +readonly FORMAT_ITALIC="\033[3m" |
| 11 | +readonly FORMAT_RED="\033[31m" |
| 12 | +readonly FORMAT_GREEN="\033[32m" |
| 13 | +readonly FORMAT_YELLOW="\033[33m" |
| 14 | +readonly FORMAT_RESET="\033[0m" |
15 | 15 |
|
16 | 16 | ## |
17 | 17 | # @param string $1 Message to print |
@@ -106,9 +106,9 @@ print_and_run() { |
106 | 106 | # |
107 | 107 | detect_default_branch() { |
108 | 108 | if local_branch_exists "master"; then |
109 | | - default_branch="master" |
| 109 | + readonly default_branch="master" |
110 | 110 | elif local_branch_exists "main"; then |
111 | | - default_branch="main" |
| 111 | + readonly default_branch="main" |
112 | 112 | else |
113 | 113 | print_error "\n ❌ Could not detect default branch (master/main)!\n" |
114 | 114 |
|
@@ -211,13 +211,13 @@ print_info "\nDetected default branch: \"${default_branch}\"." |
211 | 211 |
|
212 | 212 | print_and_run git status |
213 | 213 |
|
214 | | -original_stashes_count=$(count_stashes) |
| 214 | +readonly original_stashes_count=$(count_stashes) |
215 | 215 |
|
216 | 216 | print_and_run git stash |
217 | 217 |
|
218 | | -stashes_count_after_stash=$(count_stashes) |
| 218 | +readonly stashes_count_after_stash=$(count_stashes) |
219 | 219 |
|
220 | | -original_branch=$(git branch --show-current) |
| 220 | +readonly original_branch=$(git branch --show-current) |
221 | 221 |
|
222 | 222 | print_and_run git checkout "${default_branch}" |
223 | 223 |
|
|
0 commit comments