Skip to content

Commit f9e57e5

Browse files
committed
add pause for additional processing
1 parent 7efb4a1 commit f9e57e5

File tree

1 file changed

+71
-46
lines changed

1 file changed

+71
-46
lines changed

git-basics.sh

Lines changed: 71 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -73,33 +73,30 @@ fancy_echo "1.2 Ensure Homebrew client is installed ..."
7373
fancy_echo "1.3 $GIT_VERSION installed ..."
7474
fi
7575

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 ..."
8476

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
9385

86+
###
87+
cd ~/
88+
fancy_echo "1.5 At $PWD ..."
9489

9590
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 ..."
9792
curl -O "https://raw.githubusercontent.com/wilsonmar/git-utilities/master/git-basics.env"
9893
# 15 bytes Received
9994
else
100-
fancy_echo "1.6 Using existing git-basics.env ..."
95+
fancy_echo "1.5 Using existing git-basics.env ..."
10196
fi
102-
source git-basics.env
97+
c_echo "source git-basics.env"
98+
source git-basics.env
99+
103100
echo "GITHOST=$GITHOST" # "github.com" or "gitlab.com"
104101
echo "USER_NAME=$USER_NAME" # "Wilson Mar"
105102
echo "USER_EMAIL=$USER_EMAIL" # "[email protected]"
@@ -128,28 +125,56 @@ fancy_echo "1.2 Ensure Homebrew client is installed ..."
128125
fi
129126

130127

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+
131155
ALIAS_FILENAME="aliases.txt"
132156
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 ..."
134158
curl -O "https://raw.githubusercontent.com/wilsonmar/git-utilities/master/$ALIAS_FILENAME"
135159
# 1727 bytes Received
136160
else
137-
fancy_echo "1.7 Using existing $ALIAS_FILENAME ..."
161+
fancy_echo "1.9 Using existing $ALIAS_FILENAME ..."
138162
fi
139163

140164
BASHFILE="$HOME/.bash_profile"
141165
if [ ! -f "$BASHFILE" ]; then
142-
fancy_echo "1.8 $BASHFILE not found. Creating it ..."
166+
fancy_echo "1.10 $BASHFILE not found. Creating it ..."
143167
# echo "Created by git-basics.sh" >>$BASHFILE
144168
else
145-
fancy_echo "1.8 $BASHFILE found ..."
169+
fancy_echo "1.10 $BASHFILE found ..."
146170
ls -al "$BASHFILE" # 9462 bytes
147171
fi
148172

173+
149174
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."
151176
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 ..."
153178
ls -al "$BASHFILE"
154179
ls -al "$ALIAS_FILENAME"
155180
echo "$ALIAS_FILENAME" >>"$BASHFILE"
@@ -158,7 +183,7 @@ fancy_echo "1.2 Ensure Homebrew client is installed ..."
158183
# ./git-basics.sh: line 143: ~/.bash_profile: No such file or directory
159184
fi
160185

161-
fancy_echo "1.10 Volatile WORKSPACE_FOLDER=$WORKSPACE_FOLDER ..."
186+
fancy_echo "1.12 Volatile WORKSPACE_FOLDER=$WORKSPACE_FOLDER ..."
162187
# Delete folder from last run:
163188
cd ~/
164189
rm -rf "$WORKSPACE_FOLDER"
@@ -187,15 +212,6 @@ fancy_echo "2.3 git config --list # (could be a long file) ..."
187212
# git config --list
188213

189214

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-
199215
fancy_echo "2.4 NO Create gits folder ..."
200216

201217
fancy_echo "2.5 NO myacct container ..."
@@ -212,7 +228,7 @@ fancy_echo "2.6 mkdir $SAMPLE_REPO && cd $SAMPLE_REPO"
212228
cd "$SAMPLE_REPO"
213229

214230
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 ..."
216232
git init
217233

218234
echo "$SAMPLE_REPO" >README.md
@@ -225,21 +241,25 @@ git commit -m "Add README & gitignore"
225241
# git remote add hub-made "https://$GITHOST/$OTHER_ACCT/$SAMPLE_REPO"
226242
# echo ">>> No output expected."
227243

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+
232251
c_echo "hub create -d \"Add from local git init\""
233252
hub create -d "Add from local git init"
234253

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 ..."
236256

237257
git remote -v
238258
#git push -u origin master
239259
c_echo "git remote rename origin local-init"
240260
git remote rename origin local-init
261+
git remote -v
241262

242-
exit
243263

244264
fancy_echo "3.1 ssh-keygen is done manually, just once."
245265

@@ -248,8 +268,9 @@ c_echo "ls -a ~/.ssh"
248268

249269
fancy_echo "3.3 Delete \"$OTHER_REPO\" repo forked during previous run ..."
250270
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
253274

254275
fancy_echo "3.4 Use hub to clone \"$OTHER_ACCT/$OTHER_REPO\" ..."
255276
c_echo "cd && cd \"$WORKSPACE_FOLDER\" "
@@ -404,8 +425,10 @@ fancy_echo "6.7 git push origin :feat1 # to remove in cloud"
404425

405426
# Check manually on GitHub for new tag.
406427

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
409432
# See https://unix.stackexchange.com/questions/134437/press-space-to-continue
410433
# See https://stackoverflow.com/questions/92802/what-is-the-linux-equivalent-to-dos-pause
411434

@@ -449,6 +472,8 @@ fancy_echo "9.3 git diff master..origin/master"
449472
fancy_echo "9.4 git merge origin/master -m\"9.4 thank you\" --no-edit"
450473
git merge origin/master -m "9.4 thank you" --no-edit
451474

475+
fancy_echo "9.5 git diff master..origin/master # again to verify"
476+
git diff master..origin/master
452477

453478
FREE_DISKBLOCKS_END=$(df | sed -n -e '2{p;q}' | cut -d' ' -f 6)
454479
DIFF=$(((FREE_DISKBLOCKS_START-FREE_DISKBLOCKS_END)/2048))

0 commit comments

Comments
 (0)