Skip to content

Conversation

HonkingGoose
Copy link
Contributor

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:

  • Do not drop the first commit in the list, because that breaks the chain of references for the following commits (what should commit 2 point to if commit 1 is gone???)
  • Do not drop a commit that has work that other commits depend on.

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.

Copy link
Member

@ben ben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a couple suggestions, let me know what you think.

@ben ben merged commit 98cf2d6 into progit:master Aug 16, 2020
@HonkingGoose HonkingGoose deleted the feature/add-section-dropping-commits-with-rebase branch August 16, 2020 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chapter 7, section on rebasing, should add info on "drop" command

2 participants