WinstonSmith
WinstonSmith

Reputation: 23

GitHub: Deleted local branch how do I delete the GitHub branch

I created a new branch locally called experimental

git checkout -b experimental

I made my changes, committed them, and pushed them to GitHub. I could see the experimental branch on GitHub.

I then did:

git checkout master
git merge experimental

It showed the files it had merged

Updating 3811ea5..617606f
Fast forward
file1.py                             |  101 ++++++++++++++++++++++++++++++++
file2.py                             |   59 ++++++++++++++----

However when I did a git status it said nothing to commit. Is that correct?

Anyway I pushed to GitHub and deleted the local branch. On GitHub I now have the master and experimental both pointing to the same point. Is there any need for the experimental branch on GitHub anymore. I have deleted it locally. How do I delete it on GitHub?

Upvotes: 2

Views: 1423

Answers (3)

KVISH
KVISH

Reputation: 13208

for git version 1.5+:

git push origin :branch_to_delete

for git version 1.7+:

git push origin --delete branch_to_delete

Upvotes: 1

Madhan Ayyasamy
Madhan Ayyasamy

Reputation: 16558

git push origin :future_enhancement (Here future_enhancement is my remote branch name)

Note: If you are planning to remote master branch in git repository, might be faced some difficulties while deleting because of master branch is made it as "DEFAULT BRANCH".

Better come out from your master branch, just create any temporary branch/ if you have any other branch switch into that branch. Goto your github.com loggin with your credentials

Click =>"Account settings" link on top right corner on the github.com than Click =>"Repositories" tab from the left side menu than select your repository, there you can see "DEFAULT BRANCH" dropdown from there you have to select some other branches as default than save. Thats it from github.com.

For more details you can view this post

Upvotes: 0

Ryan Bigg
Ryan Bigg

Reputation: 107738

git push origin :experimental

As seen here, a site which was the first link for "git delete remote branch"

Upvotes: 4

Related Questions