Compare commits

..

3 Commits

View File

@@ -896,10 +896,12 @@
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"
@@ -909,20 +911,29 @@
echo "* Unsure which branch to use for '$rcvr'. Please specify."
exit 1
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
echo "* Ensuring we are on base branch '$base'."
git switch "$base"
echo "* Changing pointer for '$rcvr' to '$base'."
git branch -f "$rcvr" "$base"
#echo "* Switching to branch '$rcvr'."
#git switch "$rcvr"
echo "* Forcing push on branch '$rcvr'."
git push --force --set-upstream origin "$rcvr"
#echo "* Switching back to '$base'."
#git switch "$base"
echo "* Done! Displaying list of remote branches."
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* 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-stage="load-branch stage"