Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

windows github tool - use branch unpublish or delete?

I'm new to Github and I've been using the windows github tool which has proved a great help and handled a lot of things like SSH keys, prompts commits, discard a commit, revert commit, and it has a combined mechanism of pull+merge & push (sync), and a lot!

I'm learning it and trying to get its internal git command level executions. The other day, I merged a hotfix branch and then wanted to delete it -

git branch -d hotfix

I need to know how to delete it from the server as well. What are the git equivalents of the following two actions available in manage branch in the windows tool -

  • Unpublish a branch - remove only from the server
  • Delete a branch - remove locally and on server

Another thing I doubt is that the above git command was unable to remove the branch locally. I executed it, it removed the branch (didn't show in $ git branch) but if I restart the tool, the branch was still there! Was that a glitch?

If someone has been using these, can you pls suggest the best approach (I don't want to be totally dependent on the tool, I want to learn git as well).

like image 617
Hemant Tank Avatar asked Apr 13 '13 12:04

Hemant Tank


1 Answers

In addition to

git branch -d hotfix

you also can remove it from GitHub:

git push origin --delete hotfix

You can see more at "How do I delete a Git branch both locally and in GitHub?"


If you have already deleted branches locally, a simple:

git push --prune origin

is enough to clean those same branches on your GitHub repo.


The opposite situation is when you have deleted branches on GitHub, while they are still on your local repo.
In that case:

git remote prune origin

See "cleaning up old remote git branches".

like image 190
VonC Avatar answered Sep 24 '22 15:09

VonC