Advertisement
LordMZTE

Fetch From all git repos

Jun 1st, 2020
1,724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # store the current dir
  4. CUR_DIR=$(pwd)
  5.  
  6. # Let the person running the script know what's going on.
  7. printf "\033[0;31mPulling in latest changes for all repositories...\033[0;31m\n"
  8.  
  9. # Find all git repositories and update it to the master latest revision
  10. IFS=$'\n'
  11. for i in $(find . -name ".git" | cut -c 3-); do
  12.     echo "";
  13.     printf "\033[33m$i\033[0m\n";
  14.  
  15.     # We have to go to the .git parent directory to call the pull command
  16.     cd "$i";
  17.     cd ..;
  18.  
  19.     # finally pull
  20.     git fetch --all;
  21.  
  22.     # lets get back to the CUR_DIR
  23.     cd $CUR_DIR
  24. done
  25.  
  26. printf "\n\033[32mComplete!\033[0m\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement