You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across an interesting case during a interactive rebase. I had a history where one commit made a small change, and the following commit was a small fix to the same line. During the interactive rebase, I made commit two a fixup of commit one, but this happened to reduce the end result to something that was already on master, which interrupts the rebase with the following interesting message:
No changes
You asked to amend the most recent commit, but doing so would make
it empty. You can repeat your command with --allow-empty, or you can
remove the commit entirely with "git reset HEAD^".
Could not apply f138369... fix shellcheck again
I thought this was an interesting scenario to make a kata out of.
Here is the example I had:
Original code:
if [ -z"$URL" ];thenecho"Please specify an endpoint to call with the -u switch."
usage
exit 1;fi
Existing recent commit on master by other dev (to fix shellcheck error):
if [ -z "$URL" ]; then
echo "Please specify an endpoint to call with the -u switch."
usage
- exit 1;
fi
On the "feature" branch, I had the following two commits trying to fix the same problem:
First commit A:
if [ -z "$URL" ]; then
echo "Please specify an endpoint to call with the -u switch."
- usage- exit 1;+ usage || exit 1
fi
and the fixup commit B:
if [ -z "$URL" ]; then
echo "Please specify an endpoint to call with the -u switch."
- usage || exit 1+ usage
fi
This feature branch was originally based on a older master commit before the shellcheck fix, and then updated with a rebase on the newly fetched master, which of course changed the diff of commit A to no longer have the - exit 1; line. I am not entirely sure that this part is relevant for the case.
In the interactive rebase done to clean up this branch that also contains other changes, I made B a fixup of A. The net result was that is ends up being the exact same change as already on master. This leads to the interesting "error" mentioned above, instead of the maybe expected suggestion to just do a git rebase --skip
The text was updated successfully, but these errors were encountered:
I came across an interesting case during a interactive rebase. I had a history where one commit made a small change, and the following commit was a small fix to the same line. During the interactive rebase, I made commit two a fixup of commit one, but this happened to reduce the end result to something that was already on master, which interrupts the rebase with the following interesting message:
I thought this was an interesting scenario to make a kata out of.
Here is the example I had:
Original code:
Existing recent commit on master by other dev (to fix shellcheck error):
if [ -z "$URL" ]; then echo "Please specify an endpoint to call with the -u switch." usage - exit 1; fi
On the "feature" branch, I had the following two commits trying to fix the same problem:
First commit A:
and the fixup commit B:
This feature branch was originally based on a older master commit before the shellcheck fix, and then updated with a rebase on the newly fetched master, which of course changed the diff of commit A to no longer have the
- exit 1;
line. I am not entirely sure that this part is relevant for the case.In the interactive rebase done to clean up this branch that also contains other changes, I made B a fixup of A. The net result was that is ends up being the exact same change as already on master. This leads to the interesting "error" mentioned above, instead of the maybe expected suggestion to just do a
git rebase --skip
The text was updated successfully, but these errors were encountered: