fix config script

This commit is contained in:
Lukas 2024-03-24 15:45:16 -04:00
parent 2fc748fcb6
commit 46a0118a5f

View File

@ -1,5 +1,46 @@
git config user.name 'Lukas Vacula' # PRESETS
git config user.email 'lukas@lvacula.com' GITHUB_URL="git@github.com:ldv8434/lvacula.com.git"
GITEA_URL="https://git.vacula.xyz/dracula/lvacula.com-blog.git"
GIT_USER="Lukas Vacula"
GIT_EMAIL="ldv8434@rit.edu"
# Verify git-lfs installed
if ! git lfs -v &> /dev/null
then
echo -e "\033[0;31mgit-lfs is not installed.\nPlease add it before adding any large binary files.\033[0m"
else
git lfs install &> /dev/null
fi
# Set User
git config user.name $GIT_USER
git config user.email $GIT_EMAIL
# Sanity item
git config credential.helper cache
OPTSTRING=":rfh"
# Set Remotes
while getopts ${OPTSTRING} opt; do
case ${opt} in
r)
echo "Configuring remotes"
git remote add github $GITHUB_URL
git remote add gitea $GITEA_URL
git remote add origin $GITEA_URL
git remote set-url --add --push origin $GITHUB_URL
git remote set-url --add --push origin $GITEA_URL
;;
f)
echo "Rebaseing commits - be sure to 'git push --force'"
git rebase -r --root --exec "git commit --amend --no-edit --reset-author"
;;
h)
echo -e "-r: configure remotes for multi-push\n-f: fix commits using rebase"
;;
esac
done
# To retroactively fix commits, use the following command: # To retroactively fix commits, use the following command:
# git rebase -r --root --exec "git commit --amend --no-edit --reset-author" # git rebase -r --root --exec "git commit --amend --no-edit --reset-author"
# git push --force # git push --force