18 Commits
stage ... dev

Author SHA1 Message Date
7c93f25a5d Add output for why dev branch shows up twice during load-prod. 2025-10-15 06:45:49 -07:00
8445b64d6b Check if the dev branch exists before moving to it. 2025-10-15 06:42:16 -07:00
8dfb3fe2a6 Change rollback aliases to only go down 1 layer. Add reset aliases for going all the way back to main. 2025-10-15 06:38:50 -07:00
5b749d2100 Fix failed branch switch. Hardcode to dev! 2025-10-15 06:35:02 -07:00
57ca267aa5 Add back the display of the current local branch we're on. Add newlines for readability. 2025-10-15 06:32:28 -07:00
2ca308c287 Re-do changes lost between branch pointing. 2025-10-15 06:28:38 -07:00
40ee72b587 Only continue each commnd if they are successful. 2025-10-15 06:15:13 -07:00
13bc98d7ef Further enhancments to load-branch. Better output and branch choices. 2025-10-15 06:06:05 -07:00
d916637798 Complete the conditional branches. 2025-10-15 05:53:48 -07:00
71d236d0ba Add aliases to roll branches back to main, AKA the last official pull request. 2025-10-15 05:48:18 -07:00
d81c424878 Allow using load-prod and load-stage with any branch, and default to dev if nothing is provided. 2025-10-15 05:47:01 -07:00
73e527640f Add heads back onto the ls-remote command. 2025-10-15 05:41:12 -07:00
aa3075a9fc Do not do switch back to sender if did not switch to receiver. 2025-10-15 05:33:17 -07:00
89cdf8157f Add other missing then. 2025-10-15 05:19:57 -07:00
4e0ff86295 Add missing then. 2025-10-15 05:19:21 -07:00
305b8df6ff Ensure user is on dev branch if it exists. 2025-10-15 05:09:56 -07:00
6a78933875 Add helper for reorienting a git branch. 2025-10-15 04:52:15 -07:00
7095636915 Remove trailing s. 2025-10-14 15:03:43 -07:00
2 changed files with 74 additions and 1 deletions

View File

@@ -48,7 +48,7 @@ fi
if [[ -e "$BACKUP" ]]; then
ls -alh "$BACKUP"
echo "*** '$BACKUP' created successfully! ***"s
echo "*** '$BACKUP' created successfully! ***"
else
echo "*** '$BACKUP' not found! ***"
exit 1

View File

@@ -564,6 +564,16 @@
echo -e "\n*** `basename $project` ***"
cd $project
if [[ -d .git ]]; then
git ls-remote --exit-code --heads origin dev
dev_exists="$?"
if [[ "$dev_exists" == 0 ]]; then
git switch dev
elif [[ "$dev_exists" == 2 ]]; then
git switch main
else
echo "ERROR: Unknown status for dev_exists, '$dev_exists'."
continue
fi
git pull
git push
else
@@ -881,6 +891,68 @@
alias_sudo: |
# Allows for alias expansions when using sudo, such as doing "sudo ll".
alias sudo="sudo "
function_load_branch: |
# Change a branch to point at another.
function load-branch {
rcvr="$1" # branch which we want to modify
base="$2" # branch with the changes we want
if [[ "$rcvr" == "main" ]]; then
echo "*** ERROR: Are you nuts, fool!? Not main! Do it manually! ***"
exit 1
fi
if [[ -z "$base" ]]; then
if [[ "$rcvr" == "prod" ]]; then
base="stage"
elif [[ "$rcvr" == "stage" ]]; then
base="dev"
else
echo "* Unsure which branch to use for '$rcvr'. Please specify."
exit 1
fi
echo "* Base was not specified, using '$base' for '$rcvr'."
else
echo "* Requested pointing '$rcvr' branch to '$base'."
fi
echo -e "\n* Ensuring we are on base branch '$base'." &&
git switch "$base" &&
echo -e "\n* Changing pointer for '$rcvr' to '$base'." &&
git branch -f "$rcvr" "$base" &&
#echo -e "\n* Switching to branch '$rcvr'." &&
#git switch "$rcvr" &&
echo -e "\n* Forcing push on branch '$rcvr'." &&
git push --force --set-upstream origin "$rcvr" &&
echo -e "\n* Done! Displaying list of remote branches." &&
git ls-remote --heads | sort
if [[ "$base" != "dev" ]]; then
echo -e "\n* Checking if a dev branch exists."
git ls-remote --exit-code --heads origin dev
dev_exists="$?"
if [[ "$dev_exists" == 0 ]]; then
echo -e "\n* Switching back to dev."
git switch dev
elif [[ "$dev_exists" == 2 ]]; then
echo -e "\n* Switching back to main."
git switch main
else
echo "*** ERROR: Unknown status for dev_exists, '$dev_exists'. ***"
fi
fi
echo -e "\n* Verifying which branch we're on."
git branch
}
alias load-prod="load-branch prod"
alias load-stage="load-branch stage"
alias rollback-prod="load-branch prod main"
alias rollback-stage="load-branch stage prod"
alias rollback-dev="load-branch dev stage"
alias reset-prod="load-branch prod main"
alias reset-stage="load-branch stage main"
alias reset-dev="load-branch dev main"
- name: General | Account Management | Users | Files | Common Variable
set_fact:
@@ -956,6 +1028,7 @@
{{ function_debian_upgrade }}
{{ function_ebook_convert }}
{{ alias_sudo }}
{{ function_load_branch }}
- name: General | Account Management | Users | Files | .bashrc
blockinfile: