Forrest logo
back to the git tool

git-rename-branch:tldr:55cd1

git-rename-branch: Rename a specific branch.
$ git rename-branch ${old_branch_name} ${new_branch_name}
try on your machine

The command "git rename-branch ${old_branch_name} ${new_branch_name}" is used to rename a branch in Git. Here's how it works:

  1. Replace ${old_branch_name} with the name of the branch you want to rename. This is the branch you want to change the name of.

  2. Replace ${new_branch_name} with the new name you want to assign to the branch. This is the name you want to change the branch to.

For example, let's say you have a branch called "feature-branch" and you want to rename it to "new-feature-branch". The command would be:

git rename-branch feature-branch new-feature-branch

Once you execute this command, Git will rename the branch from "feature-branch" to "new-feature-branch". It will retain all the commits and history associated with the branch but update the branch name.

It is worth noting that this command is not a built-in Git command, and it may not be available in all versions or installations of Git. However, you can achieve the same result using other Git commands such as "git branch --move".

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 git tool