libgit2

git_repository_message

Version:

Retrieve git's prepared message

Operations such as git revert/cherry-pick/merge with the -n option stop just short of creating a commit with the changes and save their prepared message in .git/MERGE_MSG so the next git-commit execution can present it to the user for them to amend if they wish.

Use this function to get the contents of this file. Don't forget to remove the file after you create the commit.

Signature

int git_repository_message(git_buf *out, git_repository *repo);

Parameters

In
out

git_buf to write data into

In
repo

Repository to read prepared message from

Returns

int

0, GIT_ENOTFOUND if no message exists or an error code

Versions