Skip to content

allow interactive amend commit #222

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

Closed
tjhei opened this issue Aug 2, 2020 · 5 comments
Closed

allow interactive amend commit #222

tjhei opened this issue Aug 2, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@tjhei
Copy link

tjhei commented Aug 2, 2020

Commit learned to amend the last commit using ^a, which is awesome. Problem: it only works if you have staged changes to add (otherwise [c] commit is disabled).
It would be great if amend works similar to git-cola, where checking "amend" puts the changes from the last commit back into "staged" so it allows staging additional hunks, unstaging parts, and then editing the message.

Describe the solution you'd like
Add an "amend" toggle in the status view (maybe when "staged changes" are selected).

I can provide more info how it works in git-cola if needed.

@extrawurst
Copy link
Collaborator

Maybe you can give more details how git-cola does this? does it effectively rollback the last commit when u amend and then you basically do a fresh commit?

@extrawurst extrawurst added the enhancement New feature or request label Aug 8, 2020
@tjhei
Copy link
Author

tjhei commented Aug 9, 2020

Maybe you can give more details how git-cola does this? does it effectively rollback the last commit when u amend and then you basically do a fresh commit?

Certainly.

  1. You enable "amend last commit":
    image
  2. Now the last commit message, description, staged files, etc. are visible (note: this does not change anything in the working copy, git-cola just pulls up the last commit up as if it was not commited yet). You get back into the original unmodified state if you disable "amend last commit" at this point:
    image
  3. Now you can stage/unstage files, change the commit message, inspect the last commit, etc... When you hit commit:
    image

Let me know if you have other questions!

@WizardOhio24
Copy link
Contributor

With this, I'm wondering if a full roll-back feature might be good? I'm thinking that then you could roll-back to any commit, not just the first one as with amend(much like how the reword PR #312 works on the first commit and every other and so can replace amend -m which only works on the first). So this would need to checkout a certain commit, the user could make their changes, then once committed rebase the branch previously checked out on top of it. And of course, when rebasing, warn that history is about to be rewritten. It's definitely possible.

@stale
Copy link

stale bot commented Feb 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Feb 2, 2021
@stale stale bot closed this as completed Feb 9, 2021
@extrawurst
Copy link
Collaborator

This is implemented via #758

@extrawurst extrawurst removed the wontfix This will not be worked on label Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants