

Luckily, git has a nifty command for the job - git push. Git branches can be a pain to manage - especially when you want to delete them remotely.
#Git remote delete origin how to
In that case, you can delete unmerged branches forcefully by using -D (-delete-force) git branch -D feature-register How to delete a git branch Remotely? When your local branches are not merged with the remote, and you try to delete them, git will throw an error that the specific branch is not merged.

OR git branch -d feature-register (Shorter version) Here are the steps to delete a git branch locally. Git branch deletion is an essential task when working with git repositories. Tip: Always make sure to have a meaningful branch name of the git repo. Now, you have moved into the master branch and want to delete the feature-register branch. Open a command line tool and run: git checkout master You have completed the feature and now want to merge it. You are working on a feature-register branch. Once the main features are complete, all developers need to merge their branch into the master branch. Let's say a repository has a master or main branch. You will always need to checkout from the branch you want to delete.

Note: Suppose you want to delete any git branch, whether locally or remotely. So once you've mastered this simple tutorial, you'll be able to delete any git branch with ease! Then, I will demonstrate how to delete a git branch remotely using the git push command.įinally, you will learn the benefits of using these commands and some best practices for remote deletion. No problem! This simple tutorial will teach you how to do both in just minutes.įirst, you will learn how to delete a local git branch locally. Are you working on a git repository and want to delete a git branch locally?ĭo you need to delete a git branch remotely but don't know how to do that?
