# git_ui: Preserve in-progress commit message across reconnect \(\#58180\) · gitcafe/zed

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

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

Visibility: public

Requested revision: bfe0d7c8f696669dded40df535840621d4756a88

Requested commit: bfe0d7c8f696669dded40df535840621d4756a88

Commit: bfe0d7c8f696669dded40df535840621d4756a88

Tree: 614fa1ea4abebb1016bc819a80397a77e7809f9f

Author: Matt Van Horn

Committer: GitHub

## Message

```
git_ui: Preserve in-progress commit message across reconnect (#58180)

Losing the connection on a remote project, or restarting Zed, while
editing a git commit message cleared the in-progress text, because the
Git panel rebuilds the commit buffer from the repository and discards
unsent input.

This persists the draft, scoped to the active repository's work
directory, in the panel's serialized state and restores it when the
panel is rebuilt from that state: at construction when the active
repository already matches, and again in `reopen_commit_buffer` once the
commit buffer loads. The restore only applies to an empty target buffer
whose work directory matches the active repository, so it never replays
committed or cleared text and never leaks a draft across repositories.
The persisted draft is cleared after a successful commit.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #47864

Release Notes:

- Fixed in-progress git commit messages being cleared when a remote
project reconnects or Zed restarts

---------

Co-authored-by: Cole Miller <cole@zed.dev>
```

## Parents

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

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