When to delete branches in Git?

前端 未结 8 2035
走了就别回头了
走了就别回头了 2021-01-29 17:36

Suppose we have an application that\'s stable.

Tomorrow, someone reports a big ol\' bug that we decide to hotfix right away. So we create a branch for that hotfix off o

8条回答
  •  暖寄归人
    2021-01-29 18:19

    You can safely remove a branch with git branch -d yourbranch. If it contains unmerged changes (ie, you would lose commits by deleting the branch), git will tell you and won't delete it.

    So, deleting a merged branch is cheap and won't make you lose any history.

    To delete a remote branch, use git push origin :mybranch, assuming your remote name is origin and the remote branch you want do delete is named mybranch.

提交回复
热议问题