Skip to content

Commit

Permalink
sync_git_repo_from_pc1_to_pc2.sh: update formatting to improve commun…
Browse files Browse the repository at this point in the history
…ication to user

1. Add double asterisks (** **) around the words "**staged**",
"**not staged**", and "**untracked**" in the automatic `git commit`
messages in order to make them stand out more.
2. Change "1st", "2nd", "3rd" words to "1/3", "2/3", and "3/3" to give
the user a better indication of progress when updating the remote
PC2 with the synchronized changes.
  • Loading branch information
ElectricRCAircraftGuy committed Mar 24, 2020
1 parent ff8a069 commit c38d172
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions useful_scripts/sync_git_repo_from_pc1_to_pc2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ sync_pc1_to_remote_branch () {
file_names_path="$FILES_STAGED"
if [ "$num" -gt "0" ]; then
if [ "$num" -eq "1" ]; then
verbiage="1. This ${num} file was staged & is now committed:"
verbiage="1. This ${num} file was **staged** & is now committed:"
else
verbiage="1. These ${num} files were staged & are now committed:"
verbiage="1. These ${num} files were **staged** & are now committed:"
fi
commit_msg="$(printf "${commit_msg}\n\n${verbiage}")"
file_names="$(cat "$file_names_path")"
Expand All @@ -200,9 +200,9 @@ sync_pc1_to_remote_branch () {
file_names_path="$FILES_NOT_STAGED"
if [ "$num" -gt "0" ]; then
if [ "$num" -eq "1" ]; then
verbiage="2. This ${num} file was changed but not staged & is now committed:"
verbiage="2. This ${num} file was changed but **not staged** & is now committed:"
else
verbiage="2. These ${num} files were changed but not staged & are now committed:"
verbiage="2. These ${num} files were changed but **not staged** & are now committed:"
fi
commit_msg="$(printf "${commit_msg}\n\n${verbiage}")"
file_names="$(cat "$file_names_path")"
Expand All @@ -214,9 +214,9 @@ sync_pc1_to_remote_branch () {
file_names_path="$FILES_UNTRACKED"
if [ "$num" -gt "0" ]; then
if [ "$num" -eq "1" ]; then
verbiage="3. This ${num} file was untracked & is now committed:"
verbiage="3. This ${num} file was **untracked** & is now committed:"
else
verbiage="3. These ${num} files were untracked & are now committed:"
verbiage="3. These ${num} files were **untracked** & are now committed:"
fi
commit_msg="$(printf "${commit_msg}\n\n${verbiage}")"
file_names="$(cat "$file_names_path")"
Expand Down Expand Up @@ -301,13 +301,13 @@ update_pc2 () {
echo "ENSURE YOU HAVE YOUR PROPER SSH KEYS FOR GITHUB LOADED INTO YOUR SSH AGENT"
echo " (w/'ssh-add <my_github_key>') OR ELSE THESE FOLLOWING STEPS WILL FAIL!"
echo "Force pulling from remote \"$SYNC_BRANCH\" branch to overwrite local copy of this branch."
echo " 1st: git fetch origin \"$SYNC_BRANCH\""
echo " 1/3: git fetch origin \"$SYNC_BRANCH\""
git fetch origin "$SYNC_BRANCH" # MAY NEED TO COMMENT OUT DURING TESTING
echo " 2nd: git checkout \"$SYNC_BRANCH\""
echo " 2/3: git checkout \"$SYNC_BRANCH\""
# Note: this `git checkout` call automatically checks out this branch from the remote "origin" if this branch
# is not already present locally
git checkout "$SYNC_BRANCH" # MAY NEED TO COMMENT OUT DURING TESTING
echo " 3rd: git reset --hard \"origin/$SYNC_BRANCH\" (to force-update the local branch to match the origin branch)"
echo " 3/3: git reset --hard \"origin/$SYNC_BRANCH\" (to force-update the local branch to match the origin branch)"
git reset --hard "origin/$SYNC_BRANCH" # MAY NEED TO COMMENT OUT DURING TESTING

echo "---\"update_pc2\" script end---"
Expand Down

0 comments on commit c38d172

Please sign in to comment.