git branch -d gives warning

前端 未结 4 1406
一生所求
一生所求 2021-01-30 09:45

Just want to get a better understanding of the warning message after I deleted a local branch

warning: deleting branch \'old_branch\' that ha

相关标签:
4条回答
  • 2021-01-30 10:24

    This is just warning you that you have changes pushed to the branch on origin, but they are not merged into master, so you are only deleting it locally.

    It is warning you that you no longer have a local copy of that branch, but it exists in origin

    If you want to delete the remote branch as well, use git push --delete origin old_branch

    0 讨论(0)
  • 2021-01-30 10:24

    To add to the other answers, this can also mean that the change might be merged to master, just that your local copy of master does not reflect it yet. Either ways this just informs you that the local copy of your master does not have the changes you pushed on origin. Merged/Not merged...maybe,maybe not

    0 讨论(0)
  • 2021-01-30 10:33

    Assuming you currently have master checked out, it means the changes made in old_branch aren't present in master. However, they are present in old_branch on origin.

    0 讨论(0)
  • 2021-01-30 10:46

    This means your local branch old_branch is up to date with remote branch old_branch on remote origin but it is not merged to the branch master which is considered to be the main branch in the repo.

    It is just a precaution from git. It gives you a hint: maybe you did your job in the topic-branch and forget to merge it to the main branch?


    update

    Git warns you from losing your changes. For example if you do not have your old_branch on the master git then don't allow you to even delete branch that is unmerged to the master (well it allow, but with key -D which is force-delete option).

    0 讨论(0)
提交回复
热议问题