search

Home  >  Q&A  >  body text

git failed to delete branch

Problem description:
git branch shows that the local branch has the branch I want to delete

git checkout -b [filename] shows that the branch does not exist (not found)

git checkout [filename] shows failed to lock ref for update: no such file or directory

Please tell me how to solve this problem

PHP中文网PHP中文网2795 days ago730

reply all(6)I'll reply

  • ringa_lee

    ringa_lee2017-05-02 09:36:58

    git branch -d is to delete the branch

    reply
    0
  • 为情所困

    为情所困2017-05-02 09:36:58

    The error message is obvious. There is no such directory. Are you sure this branch exists?

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:36:58

    Make sure you delete the corresponding branch. git branch查看分支是否存在,注意远程分支一定要有:

    #删除远程分支
    git push origin :dev
    #删除本地分支
    git branch -D dev

    reply
    0
  • 为情所困

    为情所困2017-05-02 09:36:58

    Not particularly understandable. . . Why do I need git checkout -b to delete a branch? If you want to delete a branch, shouldn't you first switch to another branch and then git branch -d?

    reply
    0
  • 迷茫

    迷茫2017-05-02 09:36:58

    -b means build, which means new.
    -d means delete. This is the deletion you want.

    reply
    0
  • 某草草

    某草草2017-05-02 09:36:58

    Direct
    git branch -D branch-name (branch name)
    Force deletion

    reply
    0
  • Cancelreply