Allow automated script to incorporate git rebase

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











up vote
0
down vote

favorite












I have this in a script:



set -e;
base="remotes/origin/dev";
git checkout --no-track -b "$new_branch";
git rebase "$base";


on occasion, there are conflicts of course, and what happens is that git rebase exits with 1, and so the script aborts/exits early.



So my automated script doesn't work if there are conflicts, which is frequent enough that it defeats the purpose.



My question is, is there some way to suspend the script upon a non-zero exit code, and then resume the script upon a signal or something? Something like this:



git rebase "$base" || suspend --until x;


so in some other terminal I can resolve stuff and then when I am done in the current terminal I could resume? Something like that?










share|improve this question



























    up vote
    0
    down vote

    favorite












    I have this in a script:



    set -e;
    base="remotes/origin/dev";
    git checkout --no-track -b "$new_branch";
    git rebase "$base";


    on occasion, there are conflicts of course, and what happens is that git rebase exits with 1, and so the script aborts/exits early.



    So my automated script doesn't work if there are conflicts, which is frequent enough that it defeats the purpose.



    My question is, is there some way to suspend the script upon a non-zero exit code, and then resume the script upon a signal or something? Something like this:



    git rebase "$base" || suspend --until x;


    so in some other terminal I can resolve stuff and then when I am done in the current terminal I could resume? Something like that?










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have this in a script:



      set -e;
      base="remotes/origin/dev";
      git checkout --no-track -b "$new_branch";
      git rebase "$base";


      on occasion, there are conflicts of course, and what happens is that git rebase exits with 1, and so the script aborts/exits early.



      So my automated script doesn't work if there are conflicts, which is frequent enough that it defeats the purpose.



      My question is, is there some way to suspend the script upon a non-zero exit code, and then resume the script upon a signal or something? Something like this:



      git rebase "$base" || suspend --until x;


      so in some other terminal I can resolve stuff and then when I am done in the current terminal I could resume? Something like that?










      share|improve this question















      I have this in a script:



      set -e;
      base="remotes/origin/dev";
      git checkout --no-track -b "$new_branch";
      git rebase "$base";


      on occasion, there are conflicts of course, and what happens is that git rebase exits with 1, and so the script aborts/exits early.



      So my automated script doesn't work if there are conflicts, which is frequent enough that it defeats the purpose.



      My question is, is there some way to suspend the script upon a non-zero exit code, and then resume the script upon a signal or something? Something like this:



      git rebase "$base" || suspend --until x;


      so in some other terminal I can resolve stuff and then when I am done in the current terminal I could resume? Something like that?







      bash shell git return-status






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 25 at 19:39









      Jeff Schaller

      33.3k850112




      33.3k850112










      asked Sep 25 at 18:44









      Alexander Mills

      1,9751032




      1,9751032




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          To run the command once, but pause for failure:



          if ! git rebase "$base"; then
          read -p "Press ENTER when you think you've fixed it"
          fi





          share|improve this answer






















          • that is cool, but I think I just need to run the git rebase command just once, and while I am going I use git rebase --continue etc, can I prevent git rebase from being run twice here?
            – Alexander Mills
            Sep 25 at 19:29











          • hmmm, well if git rebase succeeds, it just exits with 0. If it fails, it exits with 1. Then we are expected to do git rebase --continue. So I think something like this works: git rebase || read -p "press enter to try again" , right?
            – Alexander Mills
            Sep 25 at 19:35











          • yeah your most recent edit seems to be the right thing for my use case, thx
            – Alexander Mills
            Sep 25 at 19:35










          • yes it does, I am not sure I understand why the two read commands, why not just one read command, is that a typo? And you can explain the git rebase -p? What the -p flag is doing?
            – Alexander Mills
            Sep 25 at 19:36











          • Yeah the git rebase -p, was a typo on my part. Oh I see what you are doing, so yeah, yeah if git rebase fails, we do git rebase --continue after making edits
            – Alexander Mills
            Sep 25 at 19:38











          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%2f471398%2fallow-automated-script-to-incorporate-git-rebase%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          To run the command once, but pause for failure:



          if ! git rebase "$base"; then
          read -p "Press ENTER when you think you've fixed it"
          fi





          share|improve this answer






















          • that is cool, but I think I just need to run the git rebase command just once, and while I am going I use git rebase --continue etc, can I prevent git rebase from being run twice here?
            – Alexander Mills
            Sep 25 at 19:29











          • hmmm, well if git rebase succeeds, it just exits with 0. If it fails, it exits with 1. Then we are expected to do git rebase --continue. So I think something like this works: git rebase || read -p "press enter to try again" , right?
            – Alexander Mills
            Sep 25 at 19:35











          • yeah your most recent edit seems to be the right thing for my use case, thx
            – Alexander Mills
            Sep 25 at 19:35










          • yes it does, I am not sure I understand why the two read commands, why not just one read command, is that a typo? And you can explain the git rebase -p? What the -p flag is doing?
            – Alexander Mills
            Sep 25 at 19:36











          • Yeah the git rebase -p, was a typo on my part. Oh I see what you are doing, so yeah, yeah if git rebase fails, we do git rebase --continue after making edits
            – Alexander Mills
            Sep 25 at 19:38















          up vote
          1
          down vote



          accepted










          To run the command once, but pause for failure:



          if ! git rebase "$base"; then
          read -p "Press ENTER when you think you've fixed it"
          fi





          share|improve this answer






















          • that is cool, but I think I just need to run the git rebase command just once, and while I am going I use git rebase --continue etc, can I prevent git rebase from being run twice here?
            – Alexander Mills
            Sep 25 at 19:29











          • hmmm, well if git rebase succeeds, it just exits with 0. If it fails, it exits with 1. Then we are expected to do git rebase --continue. So I think something like this works: git rebase || read -p "press enter to try again" , right?
            – Alexander Mills
            Sep 25 at 19:35











          • yeah your most recent edit seems to be the right thing for my use case, thx
            – Alexander Mills
            Sep 25 at 19:35










          • yes it does, I am not sure I understand why the two read commands, why not just one read command, is that a typo? And you can explain the git rebase -p? What the -p flag is doing?
            – Alexander Mills
            Sep 25 at 19:36











          • Yeah the git rebase -p, was a typo on my part. Oh I see what you are doing, so yeah, yeah if git rebase fails, we do git rebase --continue after making edits
            – Alexander Mills
            Sep 25 at 19:38













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          To run the command once, but pause for failure:



          if ! git rebase "$base"; then
          read -p "Press ENTER when you think you've fixed it"
          fi





          share|improve this answer














          To run the command once, but pause for failure:



          if ! git rebase "$base"; then
          read -p "Press ENTER when you think you've fixed it"
          fi






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 25 at 20:22









          Alexander Mills

          1,9751032




          1,9751032










          answered Sep 25 at 19:17









          Jeff Schaller

          33.3k850112




          33.3k850112











          • that is cool, but I think I just need to run the git rebase command just once, and while I am going I use git rebase --continue etc, can I prevent git rebase from being run twice here?
            – Alexander Mills
            Sep 25 at 19:29











          • hmmm, well if git rebase succeeds, it just exits with 0. If it fails, it exits with 1. Then we are expected to do git rebase --continue. So I think something like this works: git rebase || read -p "press enter to try again" , right?
            – Alexander Mills
            Sep 25 at 19:35











          • yeah your most recent edit seems to be the right thing for my use case, thx
            – Alexander Mills
            Sep 25 at 19:35










          • yes it does, I am not sure I understand why the two read commands, why not just one read command, is that a typo? And you can explain the git rebase -p? What the -p flag is doing?
            – Alexander Mills
            Sep 25 at 19:36











          • Yeah the git rebase -p, was a typo on my part. Oh I see what you are doing, so yeah, yeah if git rebase fails, we do git rebase --continue after making edits
            – Alexander Mills
            Sep 25 at 19:38

















          • that is cool, but I think I just need to run the git rebase command just once, and while I am going I use git rebase --continue etc, can I prevent git rebase from being run twice here?
            – Alexander Mills
            Sep 25 at 19:29











          • hmmm, well if git rebase succeeds, it just exits with 0. If it fails, it exits with 1. Then we are expected to do git rebase --continue. So I think something like this works: git rebase || read -p "press enter to try again" , right?
            – Alexander Mills
            Sep 25 at 19:35











          • yeah your most recent edit seems to be the right thing for my use case, thx
            – Alexander Mills
            Sep 25 at 19:35










          • yes it does, I am not sure I understand why the two read commands, why not just one read command, is that a typo? And you can explain the git rebase -p? What the -p flag is doing?
            – Alexander Mills
            Sep 25 at 19:36











          • Yeah the git rebase -p, was a typo on my part. Oh I see what you are doing, so yeah, yeah if git rebase fails, we do git rebase --continue after making edits
            – Alexander Mills
            Sep 25 at 19:38
















          that is cool, but I think I just need to run the git rebase command just once, and while I am going I use git rebase --continue etc, can I prevent git rebase from being run twice here?
          – Alexander Mills
          Sep 25 at 19:29





          that is cool, but I think I just need to run the git rebase command just once, and while I am going I use git rebase --continue etc, can I prevent git rebase from being run twice here?
          – Alexander Mills
          Sep 25 at 19:29













          hmmm, well if git rebase succeeds, it just exits with 0. If it fails, it exits with 1. Then we are expected to do git rebase --continue. So I think something like this works: git rebase || read -p "press enter to try again" , right?
          – Alexander Mills
          Sep 25 at 19:35





          hmmm, well if git rebase succeeds, it just exits with 0. If it fails, it exits with 1. Then we are expected to do git rebase --continue. So I think something like this works: git rebase || read -p "press enter to try again" , right?
          – Alexander Mills
          Sep 25 at 19:35













          yeah your most recent edit seems to be the right thing for my use case, thx
          – Alexander Mills
          Sep 25 at 19:35




          yeah your most recent edit seems to be the right thing for my use case, thx
          – Alexander Mills
          Sep 25 at 19:35












          yes it does, I am not sure I understand why the two read commands, why not just one read command, is that a typo? And you can explain the git rebase -p? What the -p flag is doing?
          – Alexander Mills
          Sep 25 at 19:36





          yes it does, I am not sure I understand why the two read commands, why not just one read command, is that a typo? And you can explain the git rebase -p? What the -p flag is doing?
          – Alexander Mills
          Sep 25 at 19:36













          Yeah the git rebase -p, was a typo on my part. Oh I see what you are doing, so yeah, yeah if git rebase fails, we do git rebase --continue after making edits
          – Alexander Mills
          Sep 25 at 19:38





          Yeah the git rebase -p, was a typo on my part. Oh I see what you are doing, so yeah, yeah if git rebase fails, we do git rebase --continue after making edits
          – Alexander Mills
          Sep 25 at 19:38


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471398%2fallow-automated-script-to-incorporate-git-rebase%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