Allow automated script to incorporate git rebase
Clash 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?
bash shell git return-status
add a comment |Â
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?
bash shell git return-status
add a comment |Â
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?
bash shell git return-status
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
bash shell git return-status
edited Sep 25 at 19:39
Jeff Schaller
33.3k850112
33.3k850112
asked Sep 25 at 18:44
Alexander Mills
1,9751032
1,9751032
add a comment |Â
add a comment |Â
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
that is cool, but I think I just need to run thegit rebase
command just once, and while I am going I usegit rebase --continue
etc, can I preventgit 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 thegit rebase -p
? What the -p flag is doing?
â Alexander Mills
Sep 25 at 19:36
Yeah thegit rebase -p
, was a typo on my part. Oh I see what you are doing, so yeah, yeah ifgit rebase
fails, we dogit rebase --continue
after making edits
â Alexander Mills
Sep 25 at 19:38
 |Â
show 2 more comments
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
that is cool, but I think I just need to run thegit rebase
command just once, and while I am going I usegit rebase --continue
etc, can I preventgit 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 thegit rebase -p
? What the -p flag is doing?
â Alexander Mills
Sep 25 at 19:36
Yeah thegit rebase -p
, was a typo on my part. Oh I see what you are doing, so yeah, yeah ifgit rebase
fails, we dogit rebase --continue
after making edits
â Alexander Mills
Sep 25 at 19:38
 |Â
show 2 more comments
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
that is cool, but I think I just need to run thegit rebase
command just once, and while I am going I usegit rebase --continue
etc, can I preventgit 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 thegit rebase -p
? What the -p flag is doing?
â Alexander Mills
Sep 25 at 19:36
Yeah thegit rebase -p
, was a typo on my part. Oh I see what you are doing, so yeah, yeah ifgit rebase
fails, we dogit rebase --continue
after making edits
â Alexander Mills
Sep 25 at 19:38
 |Â
show 2 more comments
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
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
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 thegit rebase
command just once, and while I am going I usegit rebase --continue
etc, can I preventgit 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 thegit rebase -p
? What the -p flag is doing?
â Alexander Mills
Sep 25 at 19:36
Yeah thegit rebase -p
, was a typo on my part. Oh I see what you are doing, so yeah, yeah ifgit rebase
fails, we dogit rebase --continue
after making edits
â Alexander Mills
Sep 25 at 19:38
 |Â
show 2 more comments
that is cool, but I think I just need to run thegit rebase
command just once, and while I am going I usegit rebase --continue
etc, can I preventgit 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 thegit rebase -p
? What the -p flag is doing?
â Alexander Mills
Sep 25 at 19:36
Yeah thegit rebase -p
, was a typo on my part. Oh I see what you are doing, so yeah, yeah ifgit rebase
fails, we dogit 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
 |Â
show 2 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password