#!/bin/bash | |
# store the current dir | |
CUR_DIR=$(pwd) | |
# Let the person running the script know what's going on. | |
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n" | |
# Find all git repositories and update it to the master latest revision | |
for i in $(find . -name ".git" | cut -c 3-); do | |
echo ""; | |
echo "\033[33m"+$i+"\033[0m"; | |
# We have to go to the .git parent directory to call the pull command | |
cd "$i"; | |
cd ..; | |
# finally pull | |
git pull origin master; | |
# lets get back to the CUR_DIR | |
cd $CUR_DIR | |
done | |
echo "\n\033[32mComplete!\033[0m\n" |
This comment has been minimized.
This comment has been minimized.
Depending on your |
This comment has been minimized.
This comment has been minimized.
Cool. // True about "echo -e" ! |
This comment has been minimized.
This comment has been minimized.
Thank you. I use a slight variation:
Using |
This comment has been minimized.
This comment has been minimized.
You need to enclose $CUR_DIR in quotes, like |
This comment has been minimized.
This comment has been minimized.
Thanks - h5! |
This comment has been minimized.
This comment has been minimized.
Awesome. This works just as intended ^^ |
This comment has been minimized.
This comment has been minimized.
Thanks this is what I was looking for! |
This comment has been minimized.
This comment has been minimized.
Call stuff! Even runs on Windows 10. |
This comment has been minimized.
This comment has been minimized.
What license is associated with this Gist? MIT? Apache? DWTFYW? :) |
This comment has been minimized.
This comment has been minimized.
dmhowcroft, Legally anything released without a copyright notice is public domain, the notice contains a year range. If you release something with a year range then a few years later you make changes without updating the copyright notice, then those changes are public domain. It was nice of you to ask the author :) |
This comment has been minimized.
This comment has been minimized.
I have some gits organized with my other gits that no longer have working github pages and so when the script gets to them it asks for a username and password. Is there any way to add to the script to make it so it just enters nothing for both the username and password? (or any other way to make it skip that hangup). I'd like to keep the related gits together for organizational purposes if possible. Thank you so much for your time and this awesome and SUPER USEFUL script :) EDIT - Also I forgot to add that I put "read" (without the quotes) at the end so I can read the text log before it closes :) |
This comment has been minimized.
This comment has been minimized.
hey guys if you want i have another script here, it follows the same idea here but with many other options, i am a noob so if you have some feedback or want to contribute please let me know :D |
This comment has been minimized.
This comment has been minimized.
If you want this to work with submodules too, I'd suggest using a slightly altered version of @mndrix's solution:
If you need to manually enter passwords for some repos, use this instead:
The |
This comment has been minimized.
This comment has been minimized.
Perfect, thanks! |
This comment has been minimized.
This comment has been minimized.
simple and does what is needed, thank you! |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
Hey guys, thought about handling cases when there are some changes made in files or any other situation where just |
This comment has been minimized.
This comment has been minimized.
Very helpful! Thank you |
This comment has been minimized.
This comment has been minimized.
thanks |
This comment has been minimized.
This comment has been minimized.
Thank you, very helpful. |
This comment has been minimized.
This comment has been minimized.
Simplest solution to fetch all remotes: $ find . -name .git -type d -exec git --git-dir '{}' fetch --all ';' |
This comment has been minimized.
This comment has been minimized.
For all find commands -prune will help save time by not searching inside of .git folders. (find man page mentions this). find ~/GIT-REPOSITORIES ( -exec test -d '{}'/.git ; ) -print -prune Pipe from there or so |
This comment has been minimized.
This comment has been minimized.
This is the variation I use: #!/usr/bin/env bash for repo in $(find . -name ".git" | cut -c 3- | sed 's/.git//g'); do current_branch= #To View #!/usr/bin/env bash for repo in $(find . -name ".git" | cut -c 3- | sed 's/.git//g'); do current_branch= |
This comment has been minimized.
This comment has been minimized.
Actually that's not 100% true but fairly close. Its not possible for Australians or Germans to release anything public domain as neither counties allow citizens to give away their rights. Its one of the reasons its so important to license things. |
This comment has been minimized.
This comment has been minimized.
My version: https://github.com/joeytwiddle/jsh/blob/master/code/shellscript/git/git-update-all-repos.sh I run it in a weekly cron job. |
This comment has been minimized.
This comment has been minimized.
find . -maxdepth 8 -name '.git' -prune -type d -printf '%h\n' | parallel --eta 'echo {} && git -C {} pull' remove echo and --eta if not needed. |
This comment has been minimized.
This comment has been minimized.
Works perfectly. Thanks! |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
Very simple, yet effective and blazingly fast. Amazing! Thanks, @harisankar-krishna-2015 |
This comment has been minimized.
This comment has been minimized.
Heh! I had this need again after 9 years and was surprised by the amount of comments =) Thanks for all suggestions - I will update the gist with improvements to run on |
This comment has been minimized.
Thanks just what I needed ;)