git pull --help
Incorporates changes from a remote repository into the current branch.
I pull the git repository for offline view of the code and like to have the updated code for the different branches. How do I pull the code for all the branches easily without doing a pull for each branch manually?
--all -- Fetch all remotes.
--all didn't help.
If the local repository is used for read only and none of the files are modified, then the below script will do the trick.
for i in $(git branch | sed 's/^.//'); do git checkout $i; git pull; done
There seems to be no git equivalent command for the same.
Like Praveen Sripati's answer, but as a shell function and it brings you back to the branch you started on.
Just put this in your ~/.bash_aliases file:
function pull-all () {
START=$(git branch | grep '\*' | set 's/^.//');
for i in $(git branch | sed 's/^.//'); do
git checkout $i;
git pull || break;
done;
git checkout $START;
};
With the || break it does a satisfactory job not screwing things up if there's a conflict or the like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With