Skip to content

Instantly share code, notes, and snippets.

@agreco
Last active October 15, 2019 15:08
Show Gist options
  • Select an option

  • Save agreco/4a9725fc1f57ae524093b243ebaa94cb to your computer and use it in GitHub Desktop.

Select an option

Save agreco/4a9725fc1f57ae524093b243ebaa94cb to your computer and use it in GitHub Desktop.
Update branch name
  • if on branch: git branch -m new-name (Rename branch locally)

OR

  • if on master branch: git branch -m old_branch new_branch (Rename branch locally)

THEN

  • git push origin :old_branch (Delete the old branch on remote)
  • Switch to branch git branch --unset-upstream (Need for some versions of git)
  • Switch to branch git push --set-upstream origin new_branch (Push new branch to origin and set local branch to track the new remote)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment