Skip to content

Allow dropping / removing commits in interactive mode #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alcroito opened this issue Aug 6, 2019 · 9 comments
Open

Allow dropping / removing commits in interactive mode #16

alcroito opened this issue Aug 6, 2019 · 9 comments
Labels
design Needs feature design work enhancement New feature or request

Comments

@alcroito
Copy link

alcroito commented Aug 6, 2019

No description provided.

@Manishearth
Copy link
Collaborator

A key invariant this tool operates on is that your actual file state doesn't change.

Now, this could work by warning you that your file state will change, and then applying those changes to the working directory.

You can do this now by moving the commit to the end and replacing "pick" with "index".

@mystor mystor added the enhancement New feature or request label Aug 6, 2019
@mystor
Copy link
Owner

mystor commented Aug 6, 2019

As @Manishearth mentioned, this tool currently tries to avoid changes which would cause your checkout to be modified, such as removing commits. It'll require some design work to figure out if and how a feature like this fits into the git revise model.

@mystor mystor added the design Needs feature design work label Aug 6, 2019
@alcroito
Copy link
Author

alcroito commented Aug 6, 2019

It would just feel natural that the regular features that are supported by git rebase --interactive would also be supported by git revise --interactive, otherwise i would have to sometime follow up a revise with a rebase, and that will touch the checkout, and thus could cause rebuilds.

@Manishearth
Copy link
Collaborator

This tool is designed for a specific kind of history editing, though, it's not a drop in rebase replacement

@alerque
Copy link
Contributor

alerque commented Aug 7, 2019

@alcroito The only case I can think of that would fit this tool would be dropping empty commits, which are pretty rare in practice. I for one would expect to have to do a rebase not a revise if something I was doing along the way was going to leave me with a different final state than what I'm in now. In other words rebase if the code is going to change along the way or revise if you are just reorganizing how the history reflects how you got to the exact state you are in now.

@mystor
Copy link
Owner

mystor commented Aug 7, 2019

@alcroito The only case I can think of that would fit this tool would be dropping empty commits, which are pretty rare in practice. I for one would expect to have to do a rebase not a revise if something I was doing along the way was going to leave me with a different final state than what I'm in now. In other words rebase if the code is going to change along the way or revise if you are just reorganizing how the history reflects how you got to the exact state you are in now.

The empty commit dropping also works OK. If you need to do that you can fixup the commit into the previous one, and nothing will change :-).

@alerque
Copy link
Contributor

alerque commented Aug 8, 2019

Savvy.

@rwe
Copy link
Contributor

rwe commented Oct 14, 2021

I feel like it would be pretty straightforward and ergonomic to internally treat drop as the currently-manual "move to end and s/pick/index/". That would behave exactly as rebase for those cases, modulo git-revise's constraint that the working tree is left untouched.

Given that, it doesn't seem that index needs to exist at all: index is required to go at the end anyway, so in all cases it's the same as that style of drop but with an additional tedium of having to manually move it to the end.

@peterjc
Copy link

peterjc commented Feb 6, 2024

I found this issue while looking into a faster interactive git rebase for a special use case.

I have a git history with a few 1000 commits exported from a wiki. Some of these commits are spam, generally followed by spam removal commit later (not necessarily the next commit which could be to a different file).

I'm trying to rebase to drop the spam commits, which in turn mean the spam-reverts become empty commits, and I'll probably want to drop those too.

[There are of course more complicated examples where the cleanup wasn't a simple single commit, and a conflict resolution would be needed, but my goal is no change to the final state of the files on disk]

It sounds like the above proposal would handle at least some of these history edits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Needs feature design work enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants