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).
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".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With