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
Fallback to file-based approach for finding appropriate commit to amend #3466
Comments
A few thoughts:
|
Good point, though I'm not worried by that if we're clear that we found a match based on matching file.
Interesting: git-absorb's approach seems reasonable |
Is your feature request related to a problem? Please describe.
I just had a situation where I had two commits on a branch (i.e. two ahead of the main branch) and one staged file which was included in the first of the two commits. The change to that file was in a separate part of the file (it was updating an import statement at the top of the file).
Upon trying to find the appropriate commit, I was told that multiple base commits were found, neither of which were my two branch commits.
Describe the solution you'd like
What I would like in this case is for lazygit to fall back to just looking to see if there is a single commit on the current branch which changed the staged file(s). If there are multiple such commits, we can just return an error, and if there is one such commit, we can show a confirmation popup saying something like 'We couldn't do a perfect match but we did find one commit which changed the staged files, jump to commit?' (I personally don't think the confirmation is necessary but I suspect you would want this @stefanhaller ).
Additional context
@stefanhaller we have definitely talked about this in the past, and we considered having a separate keybinding for taking the file-based approach, but in this case I didn't know ahead of time whether the patch-based approach would work or not (I assumed that it would), so now I think we should just extend the logic of the existing keybinding.
The text was updated successfully, but these errors were encountered: