├── README.md └── git-anons.sh /README.md: -------------------------------------------------------------------------------- 1 | # GIT-ANONS 2 | Shell script to automate push 3 | # Requirements 4 | ```sudo apt-get install inotify-tools``` 5 | -------------------------------------------------------------------------------- /git-anons.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set the path to the directory you want to monitor 4 | DIRECTORY=$1 5 | 6 | # Set the name of the remote repository and branch 7 | REMOTE=origin 8 | BRANCH=main 9 | 10 | # Start monitoring the directory for changes 11 | inotifywait -m -e modify --format %w%f "$DIRECTORY" | while read FILE; do 12 | 13 | # Get the name of the file that was modified 14 | FILENAME=$(basename "$FILE") 15 | 16 | # Get the difference in the file 17 | DIFF=$(git diff "$FILE") 18 | 19 | # Check if there are any changes 20 | if [ -n "$DIFF" ]; then 21 | 22 | # Commit the changes 23 | git add "$FILE" 24 | git commit -m "Updated $FILENAME: $DIFF" 25 | 26 | # Push the changes to the remote repository 27 | git push "$REMOTE" "$BRANCH" 28 | fi 29 | done 30 | --------------------------------------------------------------------------------