Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Repository.revert() #1297

Merged
merged 1 commit into from
May 29, 2024
Merged

Add Repository.revert() #1297

merged 1 commit into from
May 29, 2024

Conversation

jorio
Copy link
Contributor

@jorio jorio commented May 28, 2024

This exposes libgit2's git_revert(), which produces changes in the index and working directory. It also affects the repository's state (via .git/REVERT_HEAD) and prepared message (via .git/MERGE_MSG).

Rationale for adding this even though Repository.revert_commit() already exists: revert_commit() is a binding for git_revert_commit(), which is less powerful -- it doesn't check out the resulting index, and it doesn't modify the state and prepared message.


Note: git_revert() accepts additional checkout/revert settings. We could implement support for these as extra arguments to Repository.revert() in the future.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
This exposes libgit2's git_revert(), which produces changes in the index and working directory. It also affects the repository's state (via .git/REVERT_HEAD) and prepared message (via .git/MERGE_MSG).

The existing function Repository.revert_commit(), which exposes git_revert_commit(), is less powerful -- it doesn't check out the resulting index, and it doesn't modify the state and prepared message.

Note: git_revert() takes additional checkout/revert settings. We could implement support for these as extra arguments to Repository.revert() in the future.
@jdavid jdavid merged commit 584bda3 into libgit2:master May 29, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants