jesseduffield / jesseduffield/lazygit

Disable patch commands for commits on a different branch

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

Description

In the commits panel it is possible to show commits of all branches (by doing ``, "Toggle show whole git graph"). You can then show the files of a commit that is not part of the current branch, build a custom patch from it, and then perform one of the commands
- Remove patch from original commit
- Move patch out into index
- Move patch into new commit
- Move patch to selected commit (if a different commit is selected)

These will all fail with hard-to-understand errors. We should disable them when the commit is not part of the current branch (or the target commit, in case of "Move patch to selected commit").

Conversely, we may want to enable these commits if the patch was created from the branches panel, and the commit is part of the current branch. I'm not really sure this is useful, but it came up [here](https://github.com/jesseduffield/lazygit/discussions/2840#discussioncomment-9588985) and caused some confusion.

No matter what we decide about that last one, we should always include all commands in the menu, and strike out the ones that are not applicable, with tooltips explaining why.

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.