Git is the version control software we using for managing all our project. We like to use Gitlab CE a hosted solution for all our internal developers.
A developers asked how to remove a branch off my local computer and remote repository and forgot the commands.
This is what you would to….
Make sure you’re in the project directory of course.
First delete the branch locally
$ git branch -d mytest
If that didn’t work or there are pending changes, you may need to force, you can issue a delete and force at the same time by using -D
$ git branch -D mytest
Next to remove from your origin
$ git push origin --delete mytest
Older versions of git before 1.7, do it by pushing a branch, by adding the : in front of the branch name.
$ git push origin :mytest
Then other developers would issue
$ git fetch --all --prune
To update and remove the branch on their local environment.
These command works on both Linux and my local OSX desktop workstation. They are pretty universal as long as your using Git software.