Skip to content

Instantly share code, notes, and snippets.

@marcnewport
Last active December 9, 2019 01:47
Show Gist options
  • Select an option

  • Save marcnewport/f4e17bd0c5f22b6d46d2e91659b48add to your computer and use it in GitHub Desktop.

Select an option

Save marcnewport/f4e17bd0c5f22b6d46d2e91659b48add to your computer and use it in GitHub Desktop.

Checkout remote branch

  1. Fetch the remote branch references
git fetch -p
  1. Checkout the remote branch
git checkout --track origin/remote-branch

Rename a branch

  1. You are on the branch you want to rename
git branch -m new-name
  1. Delete the old-name remote branch and push the new-name local branch
git push origin :old-name new-name
  1. 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