-->

DEVOPSZONES

  • Recent blogs

    How to Change a GIT Local Branch Name

     There are 2 ways to do it. You need to use "-m" flag of git to do it. lets do it now. 

    Be in the branch you want to rename

    We can use the git checkout command to switch to another branch.

    git checkout branch-name

    Change:

    git branch -m new-branch-name

    In this example, I want to change my branch name from old-branch to new-branch.

    git branch -m new-branch

    You can use git branch to see your new branch name.

    Be in the master/main branch way:

    run git checkout master to checkout to master branch.

    You can use this syntax to rename the old branch to something new.

    git branch -m old-branch-name new-branch-name

    This is what it would look like to rename the old-branch to new-branch.

    git branch -m old-branch new-branch

    To see your new branch name, you can run git branch which will list all of your branches.

    Thanks

    No comments