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(char *out, size_t len, git_repository *repo);

Parameters

char *
In
out

Buffer to write data into or NULL to just read required size

size_t
In
len

Length of buffer in bytes

In
repo

Repository to read prepared message from

Returns

int

Bytes written to buffer, GIT_ENOTFOUND if no message, or -1 on error

Versions