jesseduffield / jesseduffield/lazygit
Picking hunks does not work for files handled via git-lfs
- Dominant language
- Go
- Stars
- 82.4k
- Forks
- 3k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 19
Description
**Describe the bug**
I rebased a branch onto another branch. A file `foo.zip` was modified in both branches. So naturally there was a conflict on rebasing. The "Files" portion of the UI (where the files are listed with A or M or something on the left) showed something unusual, but unfortunately I do not remember what exactly it was showing. I know it had two letters on the left instead of only one, but I forgot which letters exactly.
I didn't know what exactly to do, so I hit x to show the menu. I found the command to show rebase/merge options. This gave me a popup to allow me to choose abort or continue -- not what I was looking for. I wanted to decide what to do with this file.
Anyway, I was confused what to do, so I hit Enter on that line and this showed me two hunks and allowed me to pick one. It also mentioned a "size" and I knew I wanted the larger `foo.zip`, so I selected that hunk with space.
At first, I was elated because the rebase succeeded. Very slick, I thought.
The result was that `foo.zip` was replaced with a short text file, probably similar to the following:
```
version https://git-lfs.github.com/spec/v1
oid sha256:32faba9a7dea5e89e597ff4d01fa97f307065cbbde48f110e012f12c9a8a14cf
size 1440546
```
I don't know for sure that this file was handled via git-lfs, but I am just guessing based on the words in the first line of the file.
I don't know what lazygit should do, but I feel that it shouldn't clobber files like this. Maybe it could recognize that the file is handled by git-lfs and then avoid allowing the user to select a hunk? Maybe some other kind of dialog that allows me to choose one of the two files?
Of course, I just stumbled through the UI like the newbie I am, and perhaps it would also be great if "selecting a hunk" for the git-lfs textual representation would just do the right thing. But it could also be quite confusing, so perhaps some dedicated UI would be better?
**To Reproduce**
I hope I've described the problem clearly enough. I guess I could also prepare a git repo that demonstrates the problem, with concrete steps. Let me know.
**Expected behavior**
Do not destroy the contents of a git-lfs managed file.
At the very least, refuse to do normal textual merging on git-lfs managed files.
Perhaps better, provide a dedicated UI that allows the user to choose which version of the file they want.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: macOS 11.2
- Lazygit Version: 0.24.2 (installed via Homebrew)
Contributor guide
Assessment
This issue has not been assessed yet.