diff --git a/src/git_flow/command/merge.py b/src/git_flow/command/merge.py index 7e5fc84..ff2f17b 100644 --- a/src/git_flow/command/merge.py +++ b/src/git_flow/command/merge.py @@ -80,11 +80,22 @@ class MergeCommand(Command): def create_pull_request(self, token: str, branch: str, target: str): changelog = Changelog() - title = self.prompt("[Opcional] Ingrese un titulo para el PR") - title = title or branch.replace("/", ": ").replace("-", " ") + commits = Git("log", target + "..", format="%s").lines() - if title.startswith("release: "): - title = title[title.index(' ', title.index(' ') + 1) + 1:] + if len(commits) == 1: + title = commits[0] + else: + title = branch.replace("/", ": ").replace("-", " ") + + if title.startswith("release: "): + title = title[title.index(' ', title.index(' ') + 1) + 1:] + + self.info("Título del PR por defecto: " + title) + + opt_title = self.prompt("[Opcional] Ingrese otro titulo para el PR") + + if opt_title: + title = opt_title message = self.get_remote_api(token).create_pull_request( branch,