jesseduffield / jesseduffield/lazygit

Feature Request: Hunk reassignment between files during merge conflict resolution

Open
#4,687 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

Thank you for Lazygit! this program is a lifesaver.

**Is your feature request related to a problem? Please describe.**
I found it difficult when rebasing commits after refactoring code by splitting functions into different files. During rebase, when there are merge conflicts caused by moving a function from one file to another, there's no straightforward way to reassign hunks from the original file to the new destination file. This makes resolving conflicts extremely tedious and error-prone.

This commonly occurs in my workflow when I:
1. Edit an earlier commit during interactive rebase
2. Split one file into two files (e.g., move a function out to a separate module)
3. Continue the rebase, where subsequent commits that originally targeted the first file now need to be applied to the second file

**Describe the solution you'd like**
I would like a feature that allows me to reassign conflicting hunks to different files during merge conflict resolution. Specifically:

1. When viewing merge conflicts, have the ability to move a hunk from File A to File B
2. Ideally with some kind of rename detection that can suggest likely destinations for moved code
3. A simple interface to drag/assign hunks between files when the conflict is caused by code that has been relocated

This would be especially useful when the conflicting change is fully enclosed within the content that was moved to the second file (not at the border where the file-split refactor happened).

**Describe alternatives you'considered**
Currently, I have to:
1. Manually resolve conflicts by copying hunks between files in an external editor
2. Use git commands directly to stage partial changes across multiple files

I've read through the documentation and watched videos on your channel but didn't see any existing way to handle this scenario efficiently---but if this is already supported please point me at the correct documentation (or make another awesome video!)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.