Skip to content

Conversation

@stefanhaller
Copy link
Collaborator

  • PR Description

Make it possible to do interactive rebase operations (edit, reword, etc) on the initial commit of a repo.

Fixes #2381.

  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go run scripts/cheatsheet/main.go generate)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • Docs (specifically docs/Config.md) have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2023

Uffizzi Preview Environment deployment-16645

☁️ https://app.uffizzi.com/github.com/jesseduffield/lazygit/pull/2453

📄 View Application Logs etc.

What is Uffizzi? Learn more

It's not so much the total number of commits that matters here, it's just
whether we are on the first one. (This includes the other condition.)

This allows us to get rid of the condition in rebase.go.
Pass --root instead of a sha when we want to rebase down to the initial commit.
@stefanhaller
Copy link
Collaborator Author

I just realized I forgot to make the same change for the commands "Squash all fixups above" and "Amend commit with staged changes". It should be easy to support it for those in the same way; give me a few minutes to add this. :-)

@jesseduffield
Copy link
Owner

@stefanhaller serendipitous timing on that comment, I was just about to hit merge haha. I'll hold off

This includes amending changes into a given commit, since that's implemented in
terms of the former.
@stefanhaller stefanhaller force-pushed the allow-rebasing-to-first-commit branch from 681dc8a to c5cd217 Compare February 20, 2023 07:31
@stefanhaller
Copy link
Collaborator Author

I added that commit, and rebased on master.

Content(Contains("Are you sure you want to create a fixup! commit for commit")).
Confirm()
}).
NavigateToListItem(Contains("commit 01")).
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's unfortunate that we have to navigate down again here; it would be nice if the selection was adjusted down by one after creating a fixup commit, so that you stay on the same commit. I guess that's an independent fix though.

Copy link
Owner

Choose a reason for hiding this comment

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

I agree, moving the cursor down by one would be good.

@jesseduffield jesseduffield merged commit e1c376e into jesseduffield:master Feb 20, 2023
@jesseduffield
Copy link
Owner

Thanks for making this! I appreciate the extensive test coverage

@stefanhaller stefanhaller deleted the allow-rebasing-to-first-commit branch February 20, 2023 08:39
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.

Enable squash/fixup of commits up to root level

2 participants