github.bash 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. cd /home/joshua
  3. echo "working directory is /home/joshua"
  4. string_of_modified_files=$(git status | gawk '/modified:/{ print $2}')
  5. echo "string_of_modified_files == $string_of_modified_files"
  6. # $(git status | grep -o 'modified:' | wc -l) == number of modified files
  7. # This splits the string of modified files with a space between them,
  8. # into an array...
  9. # ie string=( "hello" "how" "are" )
  10. #IFS=' ' read -a array <<< $string
  11. #now array[0] == "hello"
  12. #array[1] == "how"
  13. #array[2] == "are"
  14. #IFS=' ' read -a array <<< $string_of_modified_files
  15. # for element in 0 1 2 3
  16. # do
  17. # echo "array[$element] ${array[$element]}"
  18. # done
  19. #This only stages files that are already tracked. It can't stage directoryies for some reason.
  20. # it also is not adding new files that I create.
  21. echo "$PATH"
  22. echo "git add -f $string_of_modified_files"
  23. git add -f $string_of_modified_files
  24. echo "git commit -m Regular update. Commited files include... boring"
  25. git commit -m "Regular update. Committed files include $string_of_modified_files"
  26. echo "git push -u origin master"
  27. git push -u origin master