Skip to content

sequential checkout commits (commit-wise review local branch) #4767

@goyalyashpal

Description

@goyalyashpal

Is your feature request related to a problem? Please describe.

when rewriting history as part of cleanup, i want to be able to checkout commits from older-to-newer to check if all commits are buildable.

currently in lazygit (v0.52.0), this requires following steps:

  1. go to 4-commits tab
  2. navigate to the commit say, with arrow keys.
  3. <SPC> (space) to checkout the commit (detached-head)
  4. ... outside the lazygit: do the build and confirm it's buildable / working etc.
  5. a. go to 3-branches tab,
    b. highlight base branch (attached-head 😆),
    c.<SPC> checkout.
    d. when going to 4-commits tab, this step causes the cursor to start from the first commit.
  6. repeat from step 1. for as many commits you want to verify

the proposal aims to ease the redundancy of steps 5a-d, 1, 2 in above flow.

Describe the solution you'd like

just like we are able to view commits one-by-one in lazygit commits tab, it would be nice to be able to checkout them one-by-one too.
this is what i meant by "sequential checkout" or "commit-wise review"

  1. this mode is enabled in 4-commits tab by some trigger on the intended commit to be checked out.
    say <SPC> with some modifier to keep similarity with normal checkout.
  2. a. in lazygit, all the newer commits are grayed out. this is very similar in theory to how the "Pending rebase todos" and "Commits" are separated while rebasing.
    b. should moving cursor to them be disabled too?
  3. a. press <ESC> escape to exit this mode.
    b. this will checkout the base branch. step 5 and 1 solved from the problem
    c. but the cursor will stay on the same highlighted commit. efforts in step 2 minimized from the problem
  4. navigate to some other commit, and repeat.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

i read that lazygit has review pr feature. maybe that provides a similar feature?

i have never been in position to review other people's pr locally, so, i have never seen this feature in action.

Additional context

$ lazygit --version  | sed -n -e 's/, /\n/g' -e 's/=/: /gp;'  | nu --stdin --commands 'from yaml'
╭──────────────┬────────╮
│ commit       │        │
│ build date   │        │
│ build source │ nix    │
│ version      │ 0.52.0 │
│ os           │ linux  │
│ arch         │ amd64  │
│ git version  │ 2.49.0 │
╰──────────────┴────────╯

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions