Git learning notes forcibly delete branches without merge

Source: Internet
Author: User

We know that if you want to delete a branch after it has been merge to master, you can execute the command:

Git branch-d dev-new-feature
This allows us to delete the Dev-new-feature branch.

But if the branch that is going to be deleted is a branch that does not have a merge, there is a hint like this:

$ git branch-d feature-vulcan
error:the branch ' Feature-vulcan ' is not fully merged.
If you're sure want to delete it, run ' git branch-d feature-vulcan '.
This hint tells us that the Feature-vulcan branch has not been merged, if deleted, will lose the modification, if you want to forcibly delete, you need to use the command git branch-d feature-vulcan.

Now we forcibly delete:

$ git branch-d feature-vulcan
Deleted Branch Feature-vulcan (was 756d4af).

Finally deleted the success.

Summary

To develop a new feature, it is better to create a new branch;

If you want to discard a branch that has not been merged, you can use git branch-d <name> forcibly delete it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.