Forrest logo
back to the gh tool

gh-pr-merge:tldr:23b7c

gh-pr-merge: Merge the pull request, removing the branch on both the local and the remote.
$ gh pr merge --delete-branch
try on your machine

The command "gh pr merge --delete-branch" is used to merge a pull request and delete the branch associated with it using the GitHub CLI (Command Line Interface) tool.

Here's what each part of the command does:

  • "gh" is the command that invokes the GitHub CLI.
  • "pr" is a subcommand that refers to pull requests.
  • "merge" is a subcommand used to merge the specified pull request.
  • "--delete-branch" is an option that deletes the branch associated with the pull request after it has been successfully merged.

By executing this command, you are instructing the GitHub CLI to merge a pull request and remove the branch to keep your repository clean and tidy. This feature is helpful when you no longer need the branch after merging the changes into the main branch.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the gh tool