(Git) post-receive-email: change destination addresses depending on which branch a update is pushed to

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











up vote
0
down vote

favorite
1












I have a git repository and use it as an auto-deploy system on a web page.
The repository has two branches, master and test branch. We develop the web on the test branch and once the test goes well, marge it to the master branch as a product web page.



What I want to do are as follows:



  • get notification emails

  • when someone pushes his commit to the test branch, the notification email is sent to aaa@gmail.com

  • when someone pushes his commit to the master branch, the notification email is sent to bbb@gmail.com

As far as I understand, the destination email addresses are set via a set of commands as follows:



cd repository.git
git config hooks.mailinglist "foobar"
git config hooks.announcelist "foobar"
git config hooks.emailprefix "foobar"
echo foobar > description


It looks like impossible to change the destination addresses depending on which branch updates are pushed to because I think even if I make two post-receive-email-s, like post-receive-email and post-receive-email2, the two scripts share the destination addresses set by git config hooks.mailinglist.



Is there any workaround of this matter? OR just I'm missing something?



Any advice is appreciated.







share|improve this question
























    up vote
    0
    down vote

    favorite
    1












    I have a git repository and use it as an auto-deploy system on a web page.
    The repository has two branches, master and test branch. We develop the web on the test branch and once the test goes well, marge it to the master branch as a product web page.



    What I want to do are as follows:



    • get notification emails

    • when someone pushes his commit to the test branch, the notification email is sent to aaa@gmail.com

    • when someone pushes his commit to the master branch, the notification email is sent to bbb@gmail.com

    As far as I understand, the destination email addresses are set via a set of commands as follows:



    cd repository.git
    git config hooks.mailinglist "foobar"
    git config hooks.announcelist "foobar"
    git config hooks.emailprefix "foobar"
    echo foobar > description


    It looks like impossible to change the destination addresses depending on which branch updates are pushed to because I think even if I make two post-receive-email-s, like post-receive-email and post-receive-email2, the two scripts share the destination addresses set by git config hooks.mailinglist.



    Is there any workaround of this matter? OR just I'm missing something?



    Any advice is appreciated.







    share|improve this question






















      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      I have a git repository and use it as an auto-deploy system on a web page.
      The repository has two branches, master and test branch. We develop the web on the test branch and once the test goes well, marge it to the master branch as a product web page.



      What I want to do are as follows:



      • get notification emails

      • when someone pushes his commit to the test branch, the notification email is sent to aaa@gmail.com

      • when someone pushes his commit to the master branch, the notification email is sent to bbb@gmail.com

      As far as I understand, the destination email addresses are set via a set of commands as follows:



      cd repository.git
      git config hooks.mailinglist "foobar"
      git config hooks.announcelist "foobar"
      git config hooks.emailprefix "foobar"
      echo foobar > description


      It looks like impossible to change the destination addresses depending on which branch updates are pushed to because I think even if I make two post-receive-email-s, like post-receive-email and post-receive-email2, the two scripts share the destination addresses set by git config hooks.mailinglist.



      Is there any workaround of this matter? OR just I'm missing something?



      Any advice is appreciated.







      share|improve this question












      I have a git repository and use it as an auto-deploy system on a web page.
      The repository has two branches, master and test branch. We develop the web on the test branch and once the test goes well, marge it to the master branch as a product web page.



      What I want to do are as follows:



      • get notification emails

      • when someone pushes his commit to the test branch, the notification email is sent to aaa@gmail.com

      • when someone pushes his commit to the master branch, the notification email is sent to bbb@gmail.com

      As far as I understand, the destination email addresses are set via a set of commands as follows:



      cd repository.git
      git config hooks.mailinglist "foobar"
      git config hooks.announcelist "foobar"
      git config hooks.emailprefix "foobar"
      echo foobar > description


      It looks like impossible to change the destination addresses depending on which branch updates are pushed to because I think even if I make two post-receive-email-s, like post-receive-email and post-receive-email2, the two scripts share the destination addresses set by git config hooks.mailinglist.



      Is there any workaround of this matter? OR just I'm missing something?



      Any advice is appreciated.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 23 at 12:44









      Taiki Bessho

      3351214




      3351214

























          active

          oldest

          votes











          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%2f433049%2fgit-post-receive-email-change-destination-addresses-depending-on-which-branch%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes










           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433049%2fgit-post-receive-email-change-destination-addresses-depending-on-which-branch%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