-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
23 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Test Again and Again | ||
Dales Repos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,31 @@ | ||
#!/bin/bash | ||
#set -e | ||
################################################################################################################## | ||
# Author : Dale Holden | ||
################################################################################################################## | ||
# | ||
# DO NOT JUST RUN THIS. EXAMINE AND JUDGE. RUN AT YOUR OWN RISK. | ||
# | ||
################################################################################################################## | ||
#tput setaf 0 = black | ||
#tput setaf 1 = red | ||
#tput setaf 2 = green | ||
#tput setaf 3 = yellow | ||
#tput setaf 4 = dark blue | ||
#tput setaf 5 = purple | ||
#tput setaf 6 = cyan | ||
#tput setaf 7 = gray | ||
#tput setaf 8 = light blue | ||
################################################################################################################## | ||
|
||
# reset - commit your changes or stash them before you merge | ||
# git reset --hard - ArcoLinux alias - grh | ||
|
||
# reset - go back one commit - all is lost | ||
# git reset --hard HEAD~1 | ||
|
||
# remove a file online but keep it locally | ||
# https://www.baeldung.com/ops/git-remove-file-without-deleting-it | ||
# git rm --cached file.txt | ||
|
||
# checking if I have the latest files from github | ||
echo "Checking for newer files online first" | ||
# Check for newer files online | ||
echo "Checking for newer files online first..." | ||
git pull | ||
|
||
workdir=$(pwd) | ||
|
||
rm $workdir/mirrorlist | ||
touch $workdir/mirrorlist | ||
echo "## Best Arch Linux servers worldwide | ||
Server = https://mirror.osbeck.com/archlinux/\$repo/os/\$arch | ||
Server = http://mirror.osbeck.com/archlinux/\$repo/os/\$arch | ||
Server = https://geo.mirror.pkgbuild.com/\$repo/os/\$arch | ||
Server = http://mirror.rackspace.com/archlinux/\$repo/os/\$arch | ||
Server = https://mirror.rackspace.com/archlinux/\$repo/os/\$arch | ||
Server = https://mirrors.kernel.org/archlinux/\$repo/os/\$arch | ||
" | tee $workdir/mirrorlist | ||
echo | ||
echo "getting mirrorlist" | ||
wget "https://archlinux.org/mirrorlist/?country=all&protocol=http&protocol=https&ip_version=4&ip_version=6" -O ->> $workdir/mirrorlist | ||
sed -i "s/#Server/Server/g" $workdir/mirrorlist | ||
|
||
# Below command will backup everything inside the project folder | ||
# Add changes to staging area | ||
git add --all . | ||
|
||
# Give a comment to the commit if you want | ||
echo "####################################" | ||
echo "Write your commit comment!" | ||
echo "####################################" | ||
|
||
read input | ||
|
||
# Committing to the local repository with a message containing the time details and commit text | ||
|
||
git commit -m "$input" | ||
|
||
# Push the local files to github | ||
|
||
if grep -q main .git/config; then | ||
echo "Using main" | ||
git push -u origin main | ||
# Check if there are changes to commit | ||
if git diff-index --quiet HEAD --; then | ||
echo "No changes to commit." | ||
else | ||
# Prompt user for commit message | ||
echo "Enter your commit message (press Enter for default):" | ||
read input | ||
commit_message=${input:-"Auto commit"} | ||
|
||
# Commit changes | ||
git commit -m "$commit_message" | ||
fi | ||
|
||
if grep -q master .git/config; then | ||
echo "Using master" | ||
git push -u origin master | ||
# Push changes to remote repository (default choice is "Y") | ||
read -p "Do you want to push changes to remote repository? (Y/n): " confirm | ||
confirm=${confirm:-"Y"} # Set default choice to "Y" | ||
if [[ $confirm =~ ^[Yy]$ ]]; then | ||
git push origin $(git rev-parse --abbrev-ref HEAD) | ||
echo "Changes pushed to remote repository." | ||
else | ||
echo "Changes were not pushed to remote repository." | ||
fi | ||
|
||
# force the matter | ||
# git push -u origin master --force | ||
|
||
echo "################################################################" | ||
echo "################### Git Push Done ######################" | ||
echo "################################################################" |