@@ -73,33 +73,30 @@ fancy_echo "1.2 Ensure Homebrew client is installed ..."
73
73
fancy_echo " 1.3 $GIT_VERSION installed ..."
74
74
fi
75
75
76
- # ##
77
- # Alternately, clone in github.com/wilsonmar/git-utilities
78
- cd ~ /
79
- if [ ! -d " git-utilities" ]; then
80
- mkdir git-utilities
81
- fi
82
- cd git-utilities
83
- fancy_echo " 1.4 Persistent folder $PWD ..."
84
76
85
- if [ ! -f " git-basics.sh " ] ; then
86
- fancy_echo " 1.5 Downloading git-basics.sh from GitHub for next run ... "
87
- curl -O " https://raw.githubusercontent.com/wilsonmar/git-utilities/master/git-basics.sh "
88
- # 10835 bytes Received
89
- # TODO:
90
- else
91
- fancy_echo " 1.5 Using existing git-basics.sh .. ."
92
- fi
77
+ # # Based on https://hub.github.com/
78
+ if ! command_exists hub ; then
79
+ fancy_echo " 1.4 brew install hub # add-in to Git ... "
80
+ brew install hub
81
+ else
82
+ HUB_VERSION= " $( hub version | grep " hub " ) "
83
+ fancy_echo " 1.4 $HUB_VERSION already installed for Git to manage GitHub ."
84
+ fi
93
85
86
+ # ##
87
+ cd ~ /
88
+ fancy_echo " 1.5 At $PWD ..."
94
89
95
90
if [ ! -f " git-basics.env" ]; then
96
- fancy_echo " 1.6 Downloading git-basics.env from GitHub ..."
91
+ fancy_echo " 1.5 Downloading git-basics.env from GitHub ..."
97
92
curl -O " https://raw.githubusercontent.com/wilsonmar/git-utilities/master/git-basics.env"
98
93
# 15 bytes Received
99
94
else
100
- fancy_echo " 1.6 Using existing git-basics.env ..."
95
+ fancy_echo " 1.5 Using existing git-basics.env ..."
101
96
fi
102
- source git-basics.env
97
+ c_echo " source git-basics.env"
98
+ source git-basics.env
99
+
103
100
echo " GITHOST=$GITHOST " # "github.com" or "gitlab.com"
104
101
echo " USER_NAME=$USER_NAME " # "Wilson Mar"
105
102
echo " USER_EMAIL=$USER_EMAIL " # "[email protected] "
@@ -128,28 +125,56 @@ fancy_echo "1.2 Ensure Homebrew client is installed ..."
128
125
fi
129
126
130
127
128
+ fancy_echo " 1.6 Create persistent folder git-scripts in $PWD ..."
129
+
130
+ if [ ! -d " git-scripts" ]; then
131
+ c_echo " mkdir git-scripts && cd git-scripts"
132
+ mkdir git-scripts && cd git-scripts
133
+ # else
134
+ # # if flagged to do it:
135
+ # rm -rf git-scripts
136
+ # mkdir git-scripts
137
+ fi
138
+
139
+
140
+ # ##
141
+ if [ ! -f " git-basics.sh" ]; then
142
+ fancy_echo " 1.7 Downloading git-basics.sh from GitHub for next run ..."
143
+ curl -O " https://raw.githubusercontent.com/wilsonmar/git-utilities/master/git-basics.sh"
144
+ # 10835 bytes Received
145
+ # TODO:
146
+ else
147
+ fancy_echo " 1.7 Using existing git-basics.sh ..."
148
+ fi
149
+
150
+
151
+ fancy_echo " 1.8 To halt processing for customizations, press control+c or "
152
+ read -rsp $' 1.8 press any key to continue default processing ...\n ' -n 1 key
153
+
154
+
131
155
ALIAS_FILENAME=" aliases.txt"
132
156
if [ ! -f " $ALIAS_FILENAME " ]; then
133
- fancy_echo " 1.7 Downloading $ALIAS_FILENAME from GitHub ..."
157
+ fancy_echo " 1.9 Downloading $ALIAS_FILENAME from GitHub ..."
134
158
curl -O " https://raw.githubusercontent.com/wilsonmar/git-utilities/master/$ALIAS_FILENAME "
135
159
# 1727 bytes Received
136
160
else
137
- fancy_echo " 1.7 Using existing $ALIAS_FILENAME ..."
161
+ fancy_echo " 1.9 Using existing $ALIAS_FILENAME ..."
138
162
fi
139
163
140
164
BASHFILE=" $HOME /.bash_profile"
141
165
if [ ! -f " $BASHFILE " ]; then
142
- fancy_echo " 1.8 $BASHFILE not found. Creating it ..."
166
+ fancy_echo " 1.10 $BASHFILE not found. Creating it ..."
143
167
# echo "Created by git-basics.sh" >>$BASHFILE
144
168
else
145
- fancy_echo " 1.8 $BASHFILE found ..."
169
+ fancy_echo " 1.10 $BASHFILE found ..."
146
170
ls -al " $BASHFILE " # 9462 bytes
147
171
fi
148
172
173
+
149
174
if grep " $ALIAS_FILENAME " " $BASHFILE " ; then # already in file:
150
- fancy_echo " 1.9 $ALIAS_FILENAME already found in $BASHFILE ."
175
+ fancy_echo " 1.11 $ALIAS_FILENAME already found in $BASHFILE ."
151
176
else
152
- fancy_echo " 1.9 Concatenating aliases file $ALIAS_FILENAME into $BASHFILE ..."
177
+ fancy_echo " 1.11 Concatenating aliases file $ALIAS_FILENAME into $BASHFILE ..."
153
178
ls -al " $BASHFILE "
154
179
ls -al " $ALIAS_FILENAME "
155
180
echo " $ALIAS_FILENAME " >> " $BASHFILE "
@@ -158,7 +183,7 @@ fancy_echo "1.2 Ensure Homebrew client is installed ..."
158
183
# ./git-basics.sh: line 143: ~/.bash_profile: No such file or directory
159
184
fi
160
185
161
- fancy_echo " 1.10 Volatile WORKSPACE_FOLDER=$WORKSPACE_FOLDER ..."
186
+ fancy_echo " 1.12 Volatile WORKSPACE_FOLDER=$WORKSPACE_FOLDER ..."
162
187
# Delete folder from last run:
163
188
cd ~ /
164
189
rm -rf " $WORKSPACE_FOLDER "
@@ -187,15 +212,6 @@ fancy_echo "2.3 git config --list # (could be a long file) ..."
187
212
# git config --list
188
213
189
214
190
- # # Based on https://hub.github.com/
191
- if ! command_exists hub ; then
192
- fancy_echo " 2.4 brew install hub # add-in to Git ..."
193
- brew install hub
194
- else
195
- HUB_VERSION=" $( hub version | grep " hub" ) "
196
- fancy_echo " 2.4 $HUB_VERSION already installed for Git to manage GitHub."
197
- fi
198
-
199
215
fancy_echo " 2.4 NO Create gits folder ..."
200
216
201
217
fancy_echo " 2.5 NO myacct container ..."
@@ -212,7 +228,7 @@ fancy_echo "2.6 mkdir $SAMPLE_REPO && cd $SAMPLE_REPO"
212
228
cd " $SAMPLE_REPO "
213
229
214
230
fancy_echo " 2.7 Create new repo \" $SAMPLE_REPO \" in GitHub ..."
215
- fancy_echo " 2.7 git init"
231
+ fancy_echo " 2.7 git init & add & commit ... "
216
232
git init
217
233
218
234
echo " $SAMPLE_REPO " > README.md
@@ -225,21 +241,25 @@ git commit -m "Add README & gitignore"
225
241
# git remote add hub-made "https://$GITHOST/$OTHER_ACCT/$SAMPLE_REPO"
226
242
# echo ">>> No output expected."
227
243
228
- fancy_echo " 2.7b Delete \" $SAMPLE_REPO \" repo forked during previous run ..."
229
- c_echo " hub delete \" $SAMPLE_REPO \" "
230
- hub delete " $SAMPLE_REPO "
231
- echo " Not Found is OK if it was not created last run."
244
+ fancy_echo " 2.8 Delete \" $SAMPLE_REPO \" repo forked during previous run ..."
245
+ c_echo " hub delete \" $SAMPLE_REPO \" "
246
+ RESPONSE=$( " hub delete $SAMPLE_REPO " )
247
+ echo RESPONSE
248
+ # echo "Not Found is OK if it was not created last run."
249
+ read -rsp $' Press any key after deleting ...\n ' -n 1 key
250
+
232
251
c_echo " hub create -d \" Add from local git init\" "
233
252
hub create -d " Add from local git init"
234
253
235
- fancy_echo " 2.7c Go check on https://$GITHOST /$OTHER_ACCT /$SAMPLE_REPO ..."
254
+ fancy_echo " 2.9 Go check on https://$GITHOST /$OTHER_ACCT /$SAMPLE_REPO ..."
255
+ fancy_echo " 2.10 Rename ..."
236
256
237
257
git remote -v
238
258
# git push -u origin master
239
259
c_echo " git remote rename origin local-init"
240
260
git remote rename origin local-init
261
+ git remote -v
241
262
242
- exit
243
263
244
264
fancy_echo " 3.1 ssh-keygen is done manually, just once."
245
265
@@ -248,8 +268,9 @@ c_echo "ls -a ~/.ssh"
248
268
249
269
fancy_echo " 3.3 Delete \" $OTHER_REPO \" repo forked during previous run ..."
250
270
c_echo " hub delete \" $OTHER_REPO \" "
251
- hub delete " $OTHER_REPO "
252
- echo " Not Found is OK if it was not created last run."
271
+ hub delete " $OTHER_REPO "
272
+ # echo "Not Found is OK if it was not created last run."
273
+ read -rsp $' Press any key after deleting ...\n ' -n 1 key
253
274
254
275
fancy_echo " 3.4 Use hub to clone \" $OTHER_ACCT /$OTHER_REPO \" ..."
255
276
c_echo " cd && cd \" $WORKSPACE_FOLDER \" "
@@ -404,8 +425,10 @@ fancy_echo "6.7 git push origin :feat1 # to remove in cloud"
404
425
405
426
# Check manually on GitHub for new tag.
406
427
407
- fancy_echo " 7.x Request request, use a different browser to $OTHER_ACCT /$OTHER_REPO ."
408
- read -rsp $' Press any key after adding a file in $OTHER_ACCT/$OTHER_REPO ...\n ' -n 1 key
428
+ fancy_echo " 7.1 On origin $MYACCT /$OTHER_REPO , create a Pull/Merge Request."
429
+ fancy_echo " 7.2 On upstream $OTHER_CCT /$OTHER_REPO , Squash and merge."
430
+ fancy_echo " 7.3 In upstream $OTHER_ACCT /$OTHER_REPO , Add file."
431
+ read -rsp $' Press any key after creating a new file in that repo ...\n ' -n 1 key
409
432
# See https://unix.stackexchange.com/questions/134437/press-space-to-continue
410
433
# See https://stackoverflow.com/questions/92802/what-is-the-linux-equivalent-to-dos-pause
411
434
@@ -449,6 +472,8 @@ fancy_echo "9.3 git diff master..origin/master"
449
472
fancy_echo " 9.4 git merge origin/master -m\" 9.4 thank you\" --no-edit"
450
473
git merge origin/master -m " 9.4 thank you" --no-edit
451
474
475
+ fancy_echo " 9.5 git diff master..origin/master # again to verify"
476
+ git diff master..origin/master
452
477
453
478
FREE_DISKBLOCKS_END=$( df | sed -n -e ' 2{p;q}' | cut -d' ' -f 6)
454
479
DIFF=$(( (FREE_DISKBLOCKS_START- FREE_DISKBLOCKS_END)/ 2048 ))
0 commit comments