Can I concurrently pull my git repos without gnu parallel?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












On my home machine, I use the script gitpull.sh to concurrently pull all the changes to the git repos under a given directory.



#!/usr/bin/bash

find $1 -name ".git" | sed -r 's|/[^/]+$||' | parallel git -C pull origin master


My problem is that parallel is not installed on my work computer. Is it possible to alter my script without the use of parallel?







share|improve this question




















  • do you have GNU findutils on your work computer? or something else that provides xargs? if so, you can write a version of your gitpull.sh that pipes the sed output into a shell function that does something like xargs -I git pull -C origin master &.
    – cas
    Jan 4 at 8:40











  • Is the reason why you do not have GNU Parallel covered by oletange.blogspot.com/2013/04/why-not-install-gnu-parallel.html? If not, please elaborate.
    – Ole Tange
    Jan 5 at 4:26














up vote
1
down vote

favorite












On my home machine, I use the script gitpull.sh to concurrently pull all the changes to the git repos under a given directory.



#!/usr/bin/bash

find $1 -name ".git" | sed -r 's|/[^/]+$||' | parallel git -C pull origin master


My problem is that parallel is not installed on my work computer. Is it possible to alter my script without the use of parallel?







share|improve this question




















  • do you have GNU findutils on your work computer? or something else that provides xargs? if so, you can write a version of your gitpull.sh that pipes the sed output into a shell function that does something like xargs -I git pull -C origin master &.
    – cas
    Jan 4 at 8:40











  • Is the reason why you do not have GNU Parallel covered by oletange.blogspot.com/2013/04/why-not-install-gnu-parallel.html? If not, please elaborate.
    – Ole Tange
    Jan 5 at 4:26












up vote
1
down vote

favorite









up vote
1
down vote

favorite











On my home machine, I use the script gitpull.sh to concurrently pull all the changes to the git repos under a given directory.



#!/usr/bin/bash

find $1 -name ".git" | sed -r 's|/[^/]+$||' | parallel git -C pull origin master


My problem is that parallel is not installed on my work computer. Is it possible to alter my script without the use of parallel?







share|improve this question












On my home machine, I use the script gitpull.sh to concurrently pull all the changes to the git repos under a given directory.



#!/usr/bin/bash

find $1 -name ".git" | sed -r 's|/[^/]+$||' | parallel git -C pull origin master


My problem is that parallel is not installed on my work computer. Is it possible to alter my script without the use of parallel?









share|improve this question











share|improve this question




share|improve this question










asked Jan 4 at 8:15









Brian Fitzpatrick

7291921




7291921











  • do you have GNU findutils on your work computer? or something else that provides xargs? if so, you can write a version of your gitpull.sh that pipes the sed output into a shell function that does something like xargs -I git pull -C origin master &.
    – cas
    Jan 4 at 8:40











  • Is the reason why you do not have GNU Parallel covered by oletange.blogspot.com/2013/04/why-not-install-gnu-parallel.html? If not, please elaborate.
    – Ole Tange
    Jan 5 at 4:26
















  • do you have GNU findutils on your work computer? or something else that provides xargs? if so, you can write a version of your gitpull.sh that pipes the sed output into a shell function that does something like xargs -I git pull -C origin master &.
    – cas
    Jan 4 at 8:40











  • Is the reason why you do not have GNU Parallel covered by oletange.blogspot.com/2013/04/why-not-install-gnu-parallel.html? If not, please elaborate.
    – Ole Tange
    Jan 5 at 4:26















do you have GNU findutils on your work computer? or something else that provides xargs? if so, you can write a version of your gitpull.sh that pipes the sed output into a shell function that does something like xargs -I git pull -C origin master &.
– cas
Jan 4 at 8:40





do you have GNU findutils on your work computer? or something else that provides xargs? if so, you can write a version of your gitpull.sh that pipes the sed output into a shell function that does something like xargs -I git pull -C origin master &.
– cas
Jan 4 at 8:40













Is the reason why you do not have GNU Parallel covered by oletange.blogspot.com/2013/04/why-not-install-gnu-parallel.html? If not, please elaborate.
– Ole Tange
Jan 5 at 4:26




Is the reason why you do not have GNU Parallel covered by oletange.blogspot.com/2013/04/why-not-install-gnu-parallel.html? If not, please elaborate.
– Ole Tange
Jan 5 at 4:26










3 Answers
3






active

oldest

votes

















up vote
2
down vote



accepted










Instead of parallel you could use xargs with the -P flag. Something like:



find $1 -name ".git" | sed -r 's|/[^/]+$||' | xargs -I -n 1 -P 0 git -C pull origin master





share|improve this answer



























    up vote
    2
    down vote













    You can use this tool Git-Plus to concurrently pull all the changes to the git repos under a given directory. Use this command



    $ git multi pull


    You can easily install it and use it .






    share|improve this answer



























      up vote
      1
      down vote













      You can do it using only bash, readlink, and find:



      #!/bin/bash

      while IFS= read -d '' -r g ; do
      dir="$(readlink -f "$g/..")"
      git pull -C "$dir" origin master &
      done < <(find "$@" -name '.git' -print0)


      You can make it run a bit faster with careful use of find's -maxdepth option. e.g. if you know that all .git directories are going to be found only in the top-level sub-directories of the current directory, -maxdepth 3 will stop it recursing into any lower sub-directories.



      I've used "$@" with the find command rather than the unquoted $1 you used so that not only is a directory argument optional, you can use multiple directory args and/or add whatever find options you might need to the command line.



      If the version of find on your work computer doesn't do -print0, you can use n as the input separator, but the script will break if any directory names contain a newline (which is uncommon but perfectly valid).



      while IFS= read -r g ; do 
      dir="$(readlink -f "$g/..")"
      git pull -C "$dir" origin master &
      done < <(find "$@" -name '.git')





      share|improve this answer






















        Your Answer







        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "106"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        convertImagesToLinks: false,
        noModals: false,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );








         

        draft saved


        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f414719%2fcan-i-concurrently-pull-my-git-repos-without-gnu-parallel%23new-answer', 'question_page');

        );

        Post as a guest






























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        2
        down vote



        accepted










        Instead of parallel you could use xargs with the -P flag. Something like:



        find $1 -name ".git" | sed -r 's|/[^/]+$||' | xargs -I -n 1 -P 0 git -C pull origin master





        share|improve this answer
























          up vote
          2
          down vote



          accepted










          Instead of parallel you could use xargs with the -P flag. Something like:



          find $1 -name ".git" | sed -r 's|/[^/]+$||' | xargs -I -n 1 -P 0 git -C pull origin master





          share|improve this answer






















            up vote
            2
            down vote



            accepted







            up vote
            2
            down vote



            accepted






            Instead of parallel you could use xargs with the -P flag. Something like:



            find $1 -name ".git" | sed -r 's|/[^/]+$||' | xargs -I -n 1 -P 0 git -C pull origin master





            share|improve this answer












            Instead of parallel you could use xargs with the -P flag. Something like:



            find $1 -name ".git" | sed -r 's|/[^/]+$||' | xargs -I -n 1 -P 0 git -C pull origin master






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 4 at 8:48









            sapensadler

            48016




            48016






















                up vote
                2
                down vote













                You can use this tool Git-Plus to concurrently pull all the changes to the git repos under a given directory. Use this command



                $ git multi pull


                You can easily install it and use it .






                share|improve this answer
























                  up vote
                  2
                  down vote













                  You can use this tool Git-Plus to concurrently pull all the changes to the git repos under a given directory. Use this command



                  $ git multi pull


                  You can easily install it and use it .






                  share|improve this answer






















                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote









                    You can use this tool Git-Plus to concurrently pull all the changes to the git repos under a given directory. Use this command



                    $ git multi pull


                    You can easily install it and use it .






                    share|improve this answer












                    You can use this tool Git-Plus to concurrently pull all the changes to the git repos under a given directory. Use this command



                    $ git multi pull


                    You can easily install it and use it .







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jan 4 at 10:01









                    Jai Prak

                    1212




                    1212




















                        up vote
                        1
                        down vote













                        You can do it using only bash, readlink, and find:



                        #!/bin/bash

                        while IFS= read -d '' -r g ; do
                        dir="$(readlink -f "$g/..")"
                        git pull -C "$dir" origin master &
                        done < <(find "$@" -name '.git' -print0)


                        You can make it run a bit faster with careful use of find's -maxdepth option. e.g. if you know that all .git directories are going to be found only in the top-level sub-directories of the current directory, -maxdepth 3 will stop it recursing into any lower sub-directories.



                        I've used "$@" with the find command rather than the unquoted $1 you used so that not only is a directory argument optional, you can use multiple directory args and/or add whatever find options you might need to the command line.



                        If the version of find on your work computer doesn't do -print0, you can use n as the input separator, but the script will break if any directory names contain a newline (which is uncommon but perfectly valid).



                        while IFS= read -r g ; do 
                        dir="$(readlink -f "$g/..")"
                        git pull -C "$dir" origin master &
                        done < <(find "$@" -name '.git')





                        share|improve this answer


























                          up vote
                          1
                          down vote













                          You can do it using only bash, readlink, and find:



                          #!/bin/bash

                          while IFS= read -d '' -r g ; do
                          dir="$(readlink -f "$g/..")"
                          git pull -C "$dir" origin master &
                          done < <(find "$@" -name '.git' -print0)


                          You can make it run a bit faster with careful use of find's -maxdepth option. e.g. if you know that all .git directories are going to be found only in the top-level sub-directories of the current directory, -maxdepth 3 will stop it recursing into any lower sub-directories.



                          I've used "$@" with the find command rather than the unquoted $1 you used so that not only is a directory argument optional, you can use multiple directory args and/or add whatever find options you might need to the command line.



                          If the version of find on your work computer doesn't do -print0, you can use n as the input separator, but the script will break if any directory names contain a newline (which is uncommon but perfectly valid).



                          while IFS= read -r g ; do 
                          dir="$(readlink -f "$g/..")"
                          git pull -C "$dir" origin master &
                          done < <(find "$@" -name '.git')





                          share|improve this answer
























                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote









                            You can do it using only bash, readlink, and find:



                            #!/bin/bash

                            while IFS= read -d '' -r g ; do
                            dir="$(readlink -f "$g/..")"
                            git pull -C "$dir" origin master &
                            done < <(find "$@" -name '.git' -print0)


                            You can make it run a bit faster with careful use of find's -maxdepth option. e.g. if you know that all .git directories are going to be found only in the top-level sub-directories of the current directory, -maxdepth 3 will stop it recursing into any lower sub-directories.



                            I've used "$@" with the find command rather than the unquoted $1 you used so that not only is a directory argument optional, you can use multiple directory args and/or add whatever find options you might need to the command line.



                            If the version of find on your work computer doesn't do -print0, you can use n as the input separator, but the script will break if any directory names contain a newline (which is uncommon but perfectly valid).



                            while IFS= read -r g ; do 
                            dir="$(readlink -f "$g/..")"
                            git pull -C "$dir" origin master &
                            done < <(find "$@" -name '.git')





                            share|improve this answer














                            You can do it using only bash, readlink, and find:



                            #!/bin/bash

                            while IFS= read -d '' -r g ; do
                            dir="$(readlink -f "$g/..")"
                            git pull -C "$dir" origin master &
                            done < <(find "$@" -name '.git' -print0)


                            You can make it run a bit faster with careful use of find's -maxdepth option. e.g. if you know that all .git directories are going to be found only in the top-level sub-directories of the current directory, -maxdepth 3 will stop it recursing into any lower sub-directories.



                            I've used "$@" with the find command rather than the unquoted $1 you used so that not only is a directory argument optional, you can use multiple directory args and/or add whatever find options you might need to the command line.



                            If the version of find on your work computer doesn't do -print0, you can use n as the input separator, but the script will break if any directory names contain a newline (which is uncommon but perfectly valid).



                            while IFS= read -r g ; do 
                            dir="$(readlink -f "$g/..")"
                            git pull -C "$dir" origin master &
                            done < <(find "$@" -name '.git')






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Jan 4 at 10:12

























                            answered Jan 4 at 9:28









                            cas

                            37.7k44394




                            37.7k44394






















                                 

                                draft saved


                                draft discarded


























                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f414719%2fcan-i-concurrently-pull-my-git-repos-without-gnu-parallel%23new-answer', 'question_page');

                                );

                                Post as a guest













































































                                Popular posts from this blog

                                How to check contact read email or not when send email to Individual?

                                Bahrain

                                Postfix configuration issue with fips on centos 7; mailgun relay