diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-16 19:31:55 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-16 20:37:24 +1000 |
commit | 53f06f6a4ecc9ad044c738db72ec96df26626c1e (patch) | |
tree | 39c7380aefb37da76fe20db0ea587d5d02ce1273 /pkg/commands/git.go | |
parent | c8add47fe747449110c802ef1ac23961bc1ec010 (diff) |
prefill commit reword editor
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r-- | pkg/commands/git.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index a98ad42d1..f4fb4a424 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -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" |