Create section: drop commit with git rebase -i #1484
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #824 says that we should add a section on dropping commits with
git rebase -i
script workflow.This PR adds this section.
While writing the section, I noticed how easy it is to get to a broken state by dropping a commit:
And what if a reader succeeds in dropping a commit, on purpose/accidentally, and then panicking that their work is gone forever. It can be found in the reflog of-course, but panicked readers will not know or have the ability at that point to use the reflog to retrieve their dropped commit.
If the rebase with the dropped commit is not successful, the reader will enter into a inconsistent state, and either need to manually fix the problem, or back out of the rebase with
git rebase --abort
.Given the above problems, I'm not sure whether the book should point users to such a "dangerous" thing as dropping a commit at all.... I'll let the maintainers decide on whether this belongs in the book or not.
Merging this fixes #824.