The following command will find all git
projects in your home folder and perform a pull operation on them.
find ~ -name ".git" -type d -exec bash -c "echo '{}' && cd '{}'/.. && git pull" \;
The above command is based on finding the .git
folders that exist in any clone of a git
repository. Once a .git
folder is found, it will navigate to its parent folder where it will perform the pull request.
Bonus – Automate the procedure using a cron
job
The following entry in crontab
allows us to periodically perform a pull
request on all the cloned repositories that we have in a specific folder. Specifically, it will perform this operation once every five minutes.
*/5 * * * * cd /home/bytefreaks/Projects; find . -name ".git" -type d -exec bash -c "echo '{}' && cd '{}'/.. && git pull" \; &> /tmp/bf.git.log
ssh
key that does not have a password for this automation.This post is also available in: Greek