Compare commits

...

3 Commits

View File

@@ -896,10 +896,12 @@
function load-branch { function load-branch {
rcvr="$1" # branch which we want to modify rcvr="$1" # branch which we want to modify
base="$2" # branch with the changes we want base="$2" # branch with the changes we want
if [[ "$rcvr" == "main" ]]; then if [[ "$rcvr" == "main" ]]; then
echo "*** ERROR: Are you nuts, fool!? Not main! Do it manually! ***" echo "*** ERROR: Are you nuts, fool!? Not main! Do it manually! ***"
exit 1 exit 1
fi fi
if [[ -z "$base" ]]; then if [[ -z "$base" ]]; then
if [[ "$rcvr" == "prod" ]]; then if [[ "$rcvr" == "prod" ]]; then
base="stage" base="stage"
@@ -909,20 +911,29 @@
echo "* Unsure which branch to use for '$rcvr'. Please specify." echo "* Unsure which branch to use for '$rcvr'. Please specify."
exit 1 exit 1
fi fi
echo "* Base not specified, using '$base' for '$rcvr'." echo "* Base was not specified, using '$base' for '$rcvr'."
else
echo "* Requested pointing '$rcvr' branch to '$base'."
fi fi
echo "* Ensuring we are on base branch '$base'."
git switch "$base" echo -e "\n* Ensuring we are on base branch '$base'." &&
echo "* Changing pointer for '$rcvr' to '$base'." git switch "$base" &&
git branch -f "$rcvr" "$base" echo -e "\n* Changing pointer for '$rcvr' to '$base'." &&
#echo "* Switching to branch '$rcvr'." git branch -f "$rcvr" "$base" &&
#git switch "$rcvr" #echo -e "\n* Switching to branch '$rcvr'." &&
echo "* Forcing push on branch '$rcvr'." #git switch "$rcvr" &&
git push --force --set-upstream origin "$rcvr" echo -e "\n* Forcing push on branch '$rcvr'." &&
#echo "* Switching back to '$base'." git push --force --set-upstream origin "$rcvr" &&
#git switch "$base" echo -e "\n* Done! Displaying list of remote branches." &&
echo "* Done! Displaying list of remote branches."
git ls-remote --heads | sort git ls-remote --heads | sort
if [[ "$base" != "dev" ]]; then
echo -e "\n* Switching back to dev."
git switch "$base"
fi
echo -e "\n* Verifying which branch we're on."
git branch
} }
alias load-prod="load-branch prod" alias load-prod="load-branch prod"
alias load-stage="load-branch stage" alias load-stage="load-branch stage"