How to delete branches in Git (locally and remotely)

How to delete branches in Git (locally and remotely)

In this post we will give you information about How to delete branches in Git (locally and remotely). Hear we will give you detail about How to delete branches in Git (locally and remotely)And how to use it also give you demo for it if it is necessary.

we are going to learn about how to delete a git branch locally and remotely.

consider we have a git branch called work and we need to delete it from locally and remotely.

Deleting Git branch Locally

To delete a git branch locally, we can use the git branch command followed by the -d flag and name of the branch.

Example:

# git branch -d  <branch-name>git branch -d work

Now, our work branch is successfully deleted locally.

Deleting Git branch Remotely

To delete a git branch remotely, we can use the git push command followed by the remote-name and –delete flag, branch name.

Note: In most cases, remote-name is origin.

Example:

# git push <remote-name> --delete <branch-name>git push origin --delete work

Now, our work branch is successfully deleted remotely.

Hope this code and post will helped you for implement How to delete branches in Git (locally and remotely). if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US