Ask Your Question
1

What is the process to remove a Git branch both locally and remotely?

asked 2023-06-12 11:44:32 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-06-12 11:57:02 +0000

devzero gravatar image

To remove a Git branch both locally and remotely, follow these steps:

  1. First, switch to the branch you want to delete. You can use the following command to switch the branch:

    git checkout <branch-name>
    
  2. Once you are on the branch you want to delete, you can delete the branch locally using the following command:

    git branch -D <branch-name>
    
  3. To delete the same branch from the remote repository, use the following command:

    git push origin --delete <branch-name>
    

    This will delete the branch from the remote repository.

That's it. You have removed the Git branch both locally and remotely.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-12 11:44:32 +0000

Seen: 15 times

Last updated: Jun 12 '23