How can I properly use git delete local branch to remove a branch only from my local machine?

I’ve dealt with this issue a lot, especially when I’m cleaning up my local setup to avoid accidentally committing to branches like master. First, let me say that git delete local branch, which you’re doing with git branch -d master, on’t be able to remove it, so first, make sure you’ve switched to another branch (like development). Then you can run:

git branch -d master

If Git tells you the branch isn’t fully merged, but you’re sure you want to delete it, just force it:

git branch -D master

This will only remove it locally, it doesn’t touch the remote repo at all unless you specifically push a delete command. So don’t worry about affecting anything on GitHub.