Skip to content

Instantly share code, notes, and snippets.

@chris-huffman
Created January 10, 2020 21:45
Show Gist options
  • Save chris-huffman/5d928dd1e48baaff82ff246d66c1fbad to your computer and use it in GitHub Desktop.
Save chris-huffman/5d928dd1e48baaff82ff246d66c1fbad to your computer and use it in GitHub Desktop.

#Rename a local and remote branch in git

  1. Checkout local branch.

  2. Rename local branch git branch -m {new-name}

  3. Delete the old-name remote branch and push the new-name local branch. git push {origin} :{old-name} {new-name}

  4. Reset the upstream branch for the new-name local branch. git push {origin} -u {new-name}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment