Created
June 18, 2023 13:05
-
-
Save mnadjit/c1df8d529cb90d6624a81e627771bf02 to your computer and use it in GitHub Desktop.
Shell scripts to upload or download contents of the directory passed as arguments
This file contains hidden or 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
#!/usr/bin/bash | |
if [ "$#" -eq 0 ]; then | |
echo $'No paths were passed to the script.\nScript usage:\n> ./load /path/to/dir1 /path/to/dir2' | |
fi | |
for path in "$@" | |
do | |
echo -e "\n\ngit fetch, reset and pull for path: $path\n" | |
cd $path | |
git fetch origin main | |
git reset --hard origin/main | |
git pull --force | |
done |
This file contains hidden or 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
#!/usr/bin/bash | |
if [ "$#" -eq 0 ]; then | |
echo $'No paths were passed to the script.\nScript usage:\n> ./save /path/to/dir1 /path/to/dir2' | |
fi | |
for path in "$@" | |
do | |
echo -e "\n\ngit add, commit and push for path: $path\n" | |
cd $path | |
git add --all | |
git commit -m "update" | |
git push --force | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment