# git: Introduce restore and next action \(\#50324\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/0a436bec175806d9d1785f79c4ab793e2a5e772e)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 0a436bec175806d9d1785f79c4ab793e2a5e772e

Requested commit: 0a436bec175806d9d1785f79c4ab793e2a5e772e

Commit: 0a436bec175806d9d1785f79c4ab793e2a5e772e

Tree: 9e465ff9d853266a8b5349795a85fa6c65e0b1f5

Author: Dino

Committer: GitHub

## Message

```
git: Introduce restore and next action (#50324)

Add a `git::RestoreAndNext` action that restores the diff hunk at the
cursor and advances to the next hunk. In the git diff view, the default
restore keybinding (`cmd-alt-z` on macOS, `ctrl-k ctrl-r` on
Linux/Windows) is remapped to this action so users can quickly restore
hunks in sequence. Also refactor `go_to_hunk_before_or_after_position`
to accept a `wrap_around` parameter, eliminating duplicated
hunk-navigation logic in `do_stage_or_unstage_and_next` and
`restore_and_next`.

Release Notes:

- Added a `git: restore and next` action that restores the diff hunk at
  the cursor and moves to the next one. In the git diff view, the
  default restore keybinding (`cmd-alt-z` on macOS, `ctrl-k ctrl-r` on
  Linux/Windows) now triggers this action instead of `git: restore`.

---------

Co-authored-by: Afonso <4775087+afonsograca@users.noreply.github.com>
```

## Parents

- [8475280eb11fa79b3388073967ec8c3beb001a52](https://git.cafe/gitcafe/zed/commit/8475280eb11fa79b3388073967ec8c3beb001a52?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/0a436bec175806d9d1785f79c4ab793e2a5e772e?format=markdown)
