diff --git a/pkg/commands/git_commands/branch.go b/pkg/commands/git_commands/branch.go index cd78a755b..98fc388d1 100644 --- a/pkg/commands/git_commands/branch.go +++ b/pkg/commands/git_commands/branch.go @@ -277,6 +277,7 @@ func (self *BranchCommands) Merge(branchName string, variant MergeVariant) error cmdArgs := NewGitCmd("merge"). Arg("--no-edit"). + ArgIf(self.UserConfig().Git.Commit.SignOff, "--signoff"). Arg(strings.Fields(self.UserConfig().Git.Merging.Args)...). Arg(extraArgs...). Arg(branchName). diff --git a/pkg/commands/git_commands/commit.go b/pkg/commands/git_commands/commit.go index 40d2b7319..85067b622 100644 --- a/pkg/commands/git_commands/commit.go +++ b/pkg/commands/git_commands/commit.go @@ -279,6 +279,7 @@ func (self *CommitCommands) ShowFileContentCmdObj(hash string, filePath string) func (self *CommitCommands) Revert(hashes []string, isMerge bool) error { cmdArgs := NewGitCmd("revert"). ArgIf(isMerge, "-m", "1"). + ArgIf(self.UserConfig().Git.Commit.SignOff, "--signoff"). Arg(hashes...). ToArgv() diff --git a/pkg/commands/git_commands/rebase.go b/pkg/commands/git_commands/rebase.go index 152c88bbc..f279767f0 100644 --- a/pkg/commands/git_commands/rebase.go +++ b/pkg/commands/git_commands/rebase.go @@ -558,6 +558,7 @@ func (self *RebaseCommands) CherryPickCommits(commits []*models.Commit) error { hasMergeCommit := lo.SomeBy(commits, func(c *models.Commit) bool { return c.IsMerge() }) cmdArgs := NewGitCmd("cherry-pick"). Arg("--allow-empty"). + ArgIf(self.UserConfig().Git.Commit.SignOff, "--signoff"). ArgIf(self.version.IsAtLeast(2, 45, 0), "--empty=keep", "--keep-redundant-commits"). ArgIf(hasMergeCommit, "-m1"). Arg(lo.Reverse(lo.Map(commits, func(c *models.Commit, _ int) string { return c.Hash() }))...).