...that I can never remember

Branches

CommandSummaryExample usageTips

git push origin <branchname>

Publish a locally created branch to the origin remote.Enable other developers to check out your branch. 

git push origin :<branchname>

Delete a branch on the origin remote. This command only works if <branchname> is also a local branch.

git branch -d <branchname>

Delete a branch locally. 

Always remember to:

  1. Delete the branch on the remote (if that is what you want) before deleting the branch locally. Otherwise you must recreate the branch locally
  2. Check out branch master or any branch other than branchname before trying to delete
  3. branchname locally.

 

 

 

  • No labels