1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

prefill commit reword editor

This commit is contained in:
Jesse Duffield
2020-08-16 19:31:55 +10:00
parent c8add47fe7
commit 53f06f6a4e
2 changed files with 19 additions and 1 deletions

View File

@ -501,6 +501,13 @@ func (c *GitCommand) GetHeadCommitMessage() (string, error) {
return strings.TrimSpace(message), err
}
func (c *GitCommand) GetCommitMessage(commitSha string) (string, error) {
cmdStr := "git rev-list --format=%B --max-count=1 " + commitSha
messageWithHeader, err := c.OSCommand.RunCommandWithOutput(cmdStr)
message := strings.Join(strings.SplitAfter(messageWithHeader, "\n")[1:], "\n")
return strings.TrimSpace(message), err
}
// AmendHead amends HEAD with whatever is staged in your working tree
func (c *GitCommand) AmendHead() (*exec.Cmd, error) {
command := "git commit --amend --no-edit --allow-empty"